You can’t use the !Val
condition:
const char* Val = va_arg(ArgList, const char*);
if (!Val)
break;
When using variable argument list you need to know exactly how many arguments have been passed, or (update) when to stop processing the arguments, using e.g. NULL
/ nullptr
(or any other) sentinel.