Don't crash if RemoteHost hostname is empty or short

This commit is contained in:
baldurk
2018-07-09 15:22:26 +01:00
parent 8c93750b00
commit 1c510cb3a3
+2 -1
View File
@@ -74,7 +74,8 @@ Returns the name to display for this host in the UI, either :data:`friendlyName`
DOCUMENT("Returns ``True`` if this host represents a connected ADB (Android) device.");
bool IsADB() const
{
return hostname[0] == 'a' && hostname[1] == 'd' && hostname[2] == 'b' && hostname[3] == ':';
return hostname.count() > 4 && hostname[0] == 'a' && hostname[1] == 'd' && hostname[2] == 'b' &&
hostname[3] == ':';
}
DOCUMENT("Returns ``True`` if this host represents the special localhost device.");
bool IsLocalhost() const { return hostname == "localhost"; }