Skip to content

Commit 07587bc

Browse files
author
svorenova
committed
Remove unnecessary check
If the vector is empty, std:find_if returns end
1 parent 8df4a6b commit 07587bc

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

jbmc/src/java_bytecode/java_bytecode_parser.cpp

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,17 +1257,14 @@ void java_bytecode_parsert::rmethod_attribute(methodt &method)
12571257
}
12581258

12591259
// line number of method (the first line number available)
1260-
if(!method.instructions.empty())
1261-
{
1262-
const auto it = std::find_if(
1263-
method.instructions.begin(),
1264-
method.instructions.end(),
1265-
[&](const instructiont &instruction) {
1266-
return !instruction.source_location.get_line().empty();
1267-
});
1268-
if(it != method.instructions.end())
1269-
method.source_location.set_line(it->source_location.get_line());
1270-
}
1260+
const auto it = std::find_if(
1261+
method.instructions.begin(),
1262+
method.instructions.end(),
1263+
[&](const instructiont &instruction) {
1264+
return !instruction.source_location.get_line().empty();
1265+
});
1266+
if(it != method.instructions.end())
1267+
method.source_location.set_line(it->source_location.get_line());
12711268

12721269
// method name
12731270
method.source_location.set_function(

0 commit comments

Comments
 (0)