From 1cd3c746a1d3b8d0a5eeb100ea582ff04cc4a454 Mon Sep 17 00:00:00 2001 From: methodus Date: Wed, 2 Jan 2013 21:26:22 +0100 Subject: Fixed crash if no network connection is available. Plugin will then listen on localhost --- common/tools.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/tools.cpp b/common/tools.cpp index c18d21e..d46e8c1 100644 --- a/common/tools.cpp +++ b/common/tools.cpp @@ -63,7 +63,11 @@ string GetAddressByInterface(string Interface){ return address; } string GetNetworkInterfaceByIndex(int Index, bool skipLoop){ - return GetNetworkInterfaces(skipLoop)[Index]; + StringVector interfaces = GetNetworkInterfaces(skipLoop); + if(interfaces.size() < 0) + return interfaces[Index]; + else + return string(); } StringVector GetNetworkInterfaces(bool skipLoop){ -- cgit v1.2.3