drm_hwcomposer: Ignore NULL display_contents

surfaceflinger will send in NULL display_contents in prepare/set,
make sure we don't blow up.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
Change-Id: Ia5085d4bd5e5928b52d81d14d027d0a162995946
diff --git a/hwcomposer.cpp b/hwcomposer.cpp
index ecbcd29..214b40d 100644
--- a/hwcomposer.cpp
+++ b/hwcomposer.cpp
@@ -149,6 +149,10 @@
 	/* TODO: Check flags for HWC_GEOMETRY_CHANGED */
 
 	for (i = 0; i < (int)num_displays && i < MAX_NUM_DISPLAYS; i++) {
+
+		if (!display_contents[i])
+			continue;
+
 		for (j = 0; j < (int)display_contents[i]->numHwLayers; j++) {
 			ret = hwc_prepare_layer(
 					&display_contents[i]->hwLayers[j]);
@@ -471,7 +475,8 @@
 	int ret = 0, i;
 
 	for (i = 0; i < (int)num_displays && i < MAX_NUM_DISPLAYS; i++) {
-		ret = hwc_set_display(ctx, i, display_contents[i]);
+		if (display_contents[i])
+			ret = hwc_set_display(ctx, i, display_contents[i]);
 	}
 
 	return ret;