Snap for 11391017 from 511827318ffd7c866ec917f128f4901124700823 to mainline-media-release

Change-Id: I9787a4f6c6f8a5147fa46d6e05b3ca6e10243efa
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)