Skip to content

Commit db2ef9d

Browse files
Avoid double look-up in json_object
By keeping the iterator to the found entry.
1 parent 674fce3 commit db2ef9d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

jbmc/src/java_bytecode/assignments_from_json.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,8 @@ static bool has_nondet_length(const jsont &json)
188188
if(!json.is_object())
189189
return false;
190190
const auto &json_object = to_json_object(json);
191-
if(json_object.find("@nondetLength") != json_object.end())
192-
return (json["@nondetLength"].is_true());
193-
return false;
191+
auto nondet_it = json_object.find("@nondetLength");
192+
return nondet_it != json_object.end() && nondet_it->second.is_true();
194193
}
195194

196195
/// For typed versions of primitive, string or array types, looks up their

0 commit comments

Comments
 (0)