From 935ddecc910a9ddf7dc87cfc9ab21c9025b3c90a Mon Sep 17 00:00:00 2001 From: Lee Thomason Date: Sat, 23 May 2026 16:54:50 -0700 Subject: [PATCH] Null checks in test output (#1076) Null checks in output. --- xmltest.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xmltest.cpp b/xmltest.cpp index f8e7196..db9df56 100644 --- a/xmltest.cpp +++ b/xmltest.cpp @@ -45,13 +45,15 @@ bool XMLTest (const char* testString, const char* expected, const char* found, b printf (" %s\n", testString); } else { + const char* expectedStr = expected ? expected : "(null)"; + const char* foundStr = found ? found : "(null)"; if ( extraNL ) { printf( " %s\n", testString ); - printf( "%s\n", expected ); - printf( "%s\n", found ); + printf( "%s\n", expectedStr ); + printf( "%s\n", foundStr ); } else { - printf (" %s [%s][%s]\n", testString, expected, found); + printf (" %s [%s][%s]\n", testString, expectedStr, foundStr); } }