Fix unsafe type-checks and object/array access

:Release Notes:
Fixed crashes when invalid parameters passed to some methods.

:Detailed Notes:
- added appropriate checks before accessing elements of array/object
- fixed type-checks (cjson presents "null" as NULL pointer and crashes
  when it passed to json_object_is_type)

:Testing Performed:
desktop build

:QA Notes:
Test with:
luna-send -n 1 luna://com.palm.systemservice/time/convertDate 'true'
luna-send -n 1 luna://com.palm.systemservice/setPreferences 'true'
luna-send -n 1 luna://com.palm.systemservice/osInfo/query \
    '{"parameters":null}'
luna-send -n 1 luna://com.palm.systemservice/deviceInfo/query \
    '{"parameters":null}'

:Issues Addressed:
[ANG-1354] LunaSysService crashes at location /usr/sbin/LunaSysService()

Open-webOS-DCO-1.0-Signed-off-by: Nikolay Orliuk <nikolay.orliuk@lge.com>

Change-Id: I309113684fc21ddb7fdeb1d2103b8f031f000285
Reviewed-on: https://g2g.palm.com/4721
Reviewed-by: DCO Verification
Reviewed-by: Nikolay Orliuk <nikolay.orliuk@lge.com>
Tested-by: Nikolay Orliuk <nikolay.orliuk@lge.com>
Reviewed-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>