Skip to content

Commit

Permalink
Ensure var_end is not beyond res.end()
Browse files Browse the repository at this point in the history
MSVC debug mode complains that var_end cannot be dereferenced if it hits the end of the string.
  • Loading branch information
Wedge009 committed Oct 10, 2015
1 parent 048c23c commit a2404ca
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/formula_string_utils.cpp
Expand Up @@ -146,7 +146,7 @@ static std::string do_interpolation(const std::string &str, const variable_set&
// That matters for random=, e.g. $x..$y
var_end = std::adjacent_find(var_name_begin, var_end, two_dots);
/// the default value is specified after ''?'
const std::string::iterator default_start = *var_end == '?' ? var_end + 1 : res.end();
const std::string::iterator default_start = var_end < res.end() && *var_end == '?' ? var_end + 1 : res.end();

// If the last character is '.', then it can't be a sub-variable.
// It's probably meant to be a period instead. Don't include it.
Expand Down

0 comments on commit a2404ca

Please sign in to comment.