loader: fix crash when json doesn't contain an object

When `loaderAddLayerProperties` has a json that doesn't contain an object as
the topmost value, it segfaults when looking for the `file_format_version`.
This commit fixes it by making sure the json is of the correct type before
proceding.

Files modified:
	loader/loader.c

Change-Id: I4a624e3627d5f35a1a37ec4a17b03a3926ba5907
diff --git a/loader/loader.c b/loader/loader.c
index 87d08d5..b27dea4 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -3380,6 +3380,10 @@
     layer_json_version json_version = {0, 0, 0};
     char *vers_tok;
     cJSON *disable_environment = NULL;
+    // Make sure sure the top level json value is an object
+    if(!json || json->type != 6){
+        goto out;
+    }
     item = cJSON_GetObjectItem(json, "file_format_version");
     if (item == NULL) {
         goto out;