From 6afcfeed6ce9f5e3acdaa47c0905ae228216c8e6 Mon Sep 17 00:00:00 2001 From: Dustin Jorge Date: Sat, 30 Sep 2017 21:00:44 -0700 Subject: [PATCH] Fix index logic error that caused out of range when system has only 1 mac address available. --- server/upnp.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/upnp.go b/server/upnp.go index 91881d8..e2bb444 100644 --- a/server/upnp.go +++ b/server/upnp.go @@ -1,6 +1,7 @@ package server import ( + "errors" "github.com/dustinmj/renotts/coms" "github.com/fromkeith/gossdp" "strings" @@ -101,7 +102,8 @@ func getMacStr() (string, error) { } var mac string if len(mcs) > 0 { - mac = mcs[1] + mac = mcs[0] + return strings.Replace(mac, ":", "", -1), nil } - return strings.Replace(mac, ":", "", -1), nil + return "", errors.New("could not identify valid mac address") }