Skip to content

Commit 0659ac0

Browse files
committed
Avoid accessing absent element of the empty container
1 parent 179d424 commit 0659ac0

File tree

1 file changed

+1
-1
lines changed
  • demos/classification_benchmark_demo/cpp

1 file changed

+1
-1
lines changed

demos/classification_benchmark_demo/cpp/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ int main(int argc, char* argv[]) {
317317
throw std::invalid_argument("Renderer: image provided in metadata is empty");
318318
}
319319
PredictionResult predictionResult = PredictionResult::Incorrect;
320-
std::string label = classificationResult.topLabels.front().label;
320+
std::string label = (classificationResult.topLabels.size() != 0) ? classificationResult.topLabels.front().label : "N/A";
321321
if (!FLAGS_gt.empty()) {
322322
for (size_t i = 0; i < FLAGS_nt; i++) {
323323
unsigned predictedClass = classificationResult.topLabels[i].id;

0 commit comments

Comments
 (0)