From 1c510cb3a3748d6b641e9bdaef6b8bf39c25c131 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 9 Jul 2018 15:22:26 +0100 Subject: [PATCH] Don't crash if RemoteHost hostname is empty or short --- qrenderdoc/Code/Interface/RemoteHost.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qrenderdoc/Code/Interface/RemoteHost.h b/qrenderdoc/Code/Interface/RemoteHost.h index 1ba9ff4e7..fe7c38354 100644 --- a/qrenderdoc/Code/Interface/RemoteHost.h +++ b/qrenderdoc/Code/Interface/RemoteHost.h @@ -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"; }