Snap for 11406641 from 511827318ffd7c866ec917f128f4901124700823 to mainline-permission-release

Change-Id: Ib4e74b113591c3280fdbdd50606670b6f88dff2e
diff --git a/system/OpenglSystemCommon/HostConnection.cpp b/system/OpenglSystemCommon/HostConnection.cpp
index d130073..79c92fe 100644
--- a/system/OpenglSystemCommon/HostConnection.cpp
+++ b/system/OpenglSystemCommon/HostConnection.cpp
@@ -200,7 +200,14 @@
 
     virtual uint32_t getHostHandle(native_handle_t const* handle)
     {
-        return cb_handle_t::from(handle)->hostHandle;
+        const uint32_t INVALID_HOST_HANDLE = 0;
+
+        const cb_handle_t* cb = cb_handle_t::from(handle);
+        if (cb) {
+            return cb->hostHandle;
+        } else {
+            return INVALID_HOST_HANDLE;
+        }
     }
 
     virtual int getFormat(native_handle_t const* handle)