From 8d9d5b7b2d3212ef9c317cdb81f88f08afd2c45c Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Sun, 18 Nov 2018 16:56:38 -0500 Subject: [PATCH] Fix crash if a file tries to pass arguments to a macro defined via --preprocess-defines --- src/serialization/preprocessor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/serialization/preprocessor.cpp b/src/serialization/preprocessor.cpp index 6af953509dc9..f1d76a678535 100644 --- a/src/serialization/preprocessor.cpp +++ b/src/serialization/preprocessor.cpp @@ -1566,8 +1566,9 @@ bool preprocessor_data::get_chunk() if(nb_arg - optional_arg_num != val.arguments.size()) { const std::vector& locations = utils::quoted_split(val.location, ' '); + const std::string filename = locations.empty() ? "" : get_filename(locations[0]); std::ostringstream error; - error << "Preprocessor symbol '" << symbol << "' defined at " << get_filename(locations[0]) << ":" + error << "Preprocessor symbol '" << symbol << "' defined at " << filename << ":" << val.linenum << " expects " << val.arguments.size() << " arguments, but has " << nb_arg - optional_arg_num << " arguments"; parent_.error(error.str(), linenum_);