hwc: Avoid crash when debug.hwc.fbsize is reset to 0

Sometimes, the property debug.hwc.fbsize is reset to 0.
Avoid SF crash in such instances.

Change-Id: Icf158fff8f71762dfdc5b42988a48e0f4e4fb441
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index 997af75..d9fc028 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -101,19 +101,21 @@
     char *yptr = NULL;
     if (property_get("debug.hwc.fbsize", property, NULL) > 0) {
         yptr = strcasestr(property,"x");
-        int xres_new = atoi(property);
-        int yres_new = atoi(yptr + 1);
-        if (isValidResolution(ctx,xres_new,yres_new) &&
-                 xres_new != xres_orig && yres_new != yres_orig) {
-            ctx->dpyAttr[HWC_DISPLAY_PRIMARY].xres_new = xres_new;
-            ctx->dpyAttr[HWC_DISPLAY_PRIMARY].yres_new = yres_new;
-            ctx->dpyAttr[HWC_DISPLAY_PRIMARY].customFBSize = true;
+        if(yptr) {
+            int xres_new = atoi(property);
+            int yres_new = atoi(yptr + 1);
+            if (isValidResolution(ctx,xres_new,yres_new) &&
+                xres_new != xres_orig && yres_new != yres_orig) {
+                ctx->dpyAttr[HWC_DISPLAY_PRIMARY].xres_new = xres_new;
+                ctx->dpyAttr[HWC_DISPLAY_PRIMARY].yres_new = yres_new;
+                ctx->dpyAttr[HWC_DISPLAY_PRIMARY].customFBSize = true;
 
-            //Caluculate DPI according to changed resolution.
-            float xdpi = ((float)xres_new * 25.4f) / (float)width;
-            float ydpi = ((float)yres_new * 25.4f) / (float)height;
-            ctx->dpyAttr[HWC_DISPLAY_PRIMARY].xdpi = xdpi;
-            ctx->dpyAttr[HWC_DISPLAY_PRIMARY].ydpi = ydpi;
+                //Caluculate DPI according to changed resolution.
+                float xdpi = ((float)xres_new * 25.4f) / (float)width;
+                float ydpi = ((float)yres_new * 25.4f) / (float)height;
+                ctx->dpyAttr[HWC_DISPLAY_PRIMARY].xdpi = xdpi;
+                ctx->dpyAttr[HWC_DISPLAY_PRIMARY].ydpi = ydpi;
+            }
         }
     }
 }