Avoid native crash in NinePatch with null chunk

The NinePatch constructor can be called by developers directly, and it
does not perform null checks on its arguments. However, if chunk is
null, it causes a segmentation fault during native initialization of the
object.
This inserts a null check for chunk before calling the native method
validateNinePatchChunk. If chunk is null, it throws an exception, which
is the behaviour of the native method for other non-null invalid
arguments.

Bug: N/A
Test: N/A
Change-Id: Ifef3a51dfdd2067e51d257161677f29541dea9c0
(cherry picked from commit 673691fe9d1698e4c115ae67eb0093d027576f7d)
2 files changed