Null check to fix crash

Need to make sure that img is not zero.

bug: 6864545
Change-Id: I2a2c5440347681b462abaa5ac9101ddb6137c8c4
merge in jb-mr0-release history after reset to jb-dev
DO NOT MERGE Fix memory leak

 Cherry pick

 Bug: 6952980
 GraphicsContext::createOffscreenContext creates an instance of both
 PlatformGraphicsSkia and GraphicsContext for ImageBuffer. However,
 ImageBuffer will only call delete on the GraphicsContext. In normal
 GC usage, the PlatformGraphicsContext's lifecycle is longer than the
 GCs, and is cleaned up by itself. This will result in leaking the
 PlatformGraphicsSkia context, though. We need to make sure to call
 delete on the PlatformGraphicsSkia context if we were initialized
 with the deleteUs() flag, which is used to indicate just this scenario.

Change-Id: If908dcb44e99568b92ee63d6337ce9f84adc9adf
merge in jb-mr0-release history after reset to jb-dev
DO NOT MERGE Null check

 Cherry pick

 Bug: 6975836
 Fixes a crash in find on page

Change-Id: I20e1597f2f3a381ee693c1bcef944243ca654110
merge in jb-mr0-release history after reset to jb-dev
Fix browser rendering issue: pure color tiles are rendered black

The “pure color tile” optimization finds the pure-color tiles and
then draws the tiles simply with the color (otherwise the texture).

But the RGBA color pointer type is char, which may overflow when
the value is larger than 127. In such case, the tiles in question
are rendered black, because of the wrong color. This bug is fixed
by defining the pointer as unsigned char.

Author: Yuyang Du <yuyang.du@intel.com>
Signed-off-by: Yuyang Du <yuyang.du@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>

(cherry picked from commit 68ca7b3168f78f2354bf15934857c1705f22025e)

Change-Id: Ia9084ec9b9f56347fb933019798baad3e1956b51
Merge android-4.1.2_r1