Fix potential NPE with null cursor

Detect and handle null cursors returned from CP2 queries.

Bug:12767708
Change-Id: I7bc4f97848a59140aba5a2c924c79fdc2749b150
(cherry picked from commit 23fe38b225346526e3f425570f3648dd7d893a5d)
3 files changed