Browse code

add some null argument checks before using the json api.

Steven Morgan authored on 2017/10/12 01:49:39
Showing 1 changed files
... ...
@@ -1161,7 +1161,8 @@ parseMHTMLComment(const char *comment, cli_ctx *ctx, void *wrkjobj, void *cbdata
1161 1161
 			cli_dbgmsg("parseMHTMLComment: cannot intialize xmlReader\n");
1162 1162
 
1163 1163
 #if HAVE_JSON
1164
-			ret = cli_json_parse_error(ctx->wrkproperty, "MHTML_ERROR_XML_READER_MEM");
1164
+                       if (ctx->wrkproperty != NULL)
1165
+                           ret = cli_json_parse_error(ctx->wrkproperty, "MHTML_ERROR_XML_READER_MEM");
1165 1166
 #endif
1166 1167
 			return ret; // libxml2 failed!
1167 1168
 		}
... ...
@@ -1230,7 +1231,8 @@ parseRootMHTML(mbox_ctx *mctx, message *m, text *t)
1230 1230
 	if (htmlDoc == NULL) {
1231 1231
 		cli_dbgmsg("parseRootMHTML: cannot intialize read html document\n");
1232 1232
 #if HAVE_JSON
1233
-		ret = cli_json_parse_error(ctx->wrkproperty, "MHTML_ERROR_HTML_READ");
1233
+                if (ctx->wrkproperty != NULL)
1234
+                    ret = cli_json_parse_error(ctx->wrkproperty, "MHTML_ERROR_HTML_READ");
1234 1235
 		if (ret != CL_SUCCESS)
1235 1236
 			rc = FAIL;
1236 1237
 #endif
... ...
@@ -1253,7 +1255,8 @@ parseRootMHTML(mbox_ctx *mctx, message *m, text *t)
1253 1253
 	if (reader == NULL) {
1254 1254
 		cli_dbgmsg("parseRootMHTML: cannot intialize xmlTextReader\n");
1255 1255
 #if HAVE_JSON
1256
-		ret = cli_json_parse_error(ctx->wrkproperty, "MHTML_ERROR_XML_READER_IO");
1256
+                if (ctx->wrkproperty != NULL)
1257
+                    ret = cli_json_parse_error(ctx->wrkproperty, "MHTML_ERROR_XML_READER_IO");
1257 1258
 		if (ret != CL_SUCCESS)
1258 1259
 			rc = FAIL;
1259 1260
 #endif
... ...
@@ -1442,7 +1445,8 @@ parseEmailBody(message *messageIn, text *textIn, mbox_ctx *mctx, unsigned int re
1442 1442
 			boundary = messageFindArgument(mainMessage, "boundary");
1443 1443
 
1444 1444
 #if HAVE_JSON
1445
-			cli_jsonstr(mctx->wrkobj, "Boundary", boundary);
1445
+                        if (mctx->wrkobj != NULL)
1446
+                            cli_jsonstr(mctx->wrkobj, "Boundary", boundary);
1446 1447
 #endif
1447 1448
 
1448 1449
 			if(boundary == NULL) {