1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-24 21:33:51 +03:00

xmllint: Check for NULL input in xmlHTMLValidityError

`ctxt->input` can be NULL after commit 61b4c42f.
This commit is contained in:
Nick Wellnhofer 2024-05-06 11:16:01 +02:00
parent ef6e6012e2
commit 3afaff7e8e

View File

@ -672,10 +672,13 @@ xmlHTMLValidityError(void *ctx, const char *msg, ...)
buffer[0] = 0;
input = ctxt->input;
if ((input->filename == NULL) && (ctxt->inputNr > 1))
input = ctxt->inputTab[ctxt->inputNr - 2];
xmlHTMLPrintFileInfo(input);
if (input != NULL) {
if ((input->filename == NULL) && (ctxt->inputNr > 1))
input = ctxt->inputTab[ctxt->inputNr - 2];
xmlHTMLPrintFileInfo(input);
}
fprintf(ERR_STREAM, "<b>validity error</b>: ");
len = strlen(buffer);
@ -685,7 +688,8 @@ xmlHTMLValidityError(void *ctx, const char *msg, ...)
xmlHTMLEncodeSend();
fprintf(ERR_STREAM, "</p>\n");
xmlHTMLPrintFileContext(input);
if (input != NULL)
xmlHTMLPrintFileContext(input);
xmlHTMLEncodeSend();
progresult = XMLLINT_ERR_VALID;
}