Error if neither -iface or -name is specified

This prevents a nil pointer dereference if (e.g.) weaver is
invoked with no arguments.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
This commit is contained in:
Alex Bligh committed 2015-04-10 15:14:51 +01:00
1 parent c13980af4b
commit 24bd7151e2
1 file changed
+3
+3
View File
@@ -92,6 +92,9 @@ func main() {
}
if routerName == "" {
if iface == nil {
log.Fatal("Either an interface must be specified with -iface or a name with -name")
}
routerName = iface.HardwareAddr.String()
}