Snap for 11390602 from 511827318ffd7c866ec917f128f4901124700823 to mainline-art-release

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