Skip to content

Commit

Permalink
cameracapture: Ignore invalid arguments in saveControlValue
Browse files Browse the repository at this point in the history
  • Loading branch information
pkoscik authored and jbylicki committed Jan 22, 2024
1 parent 7b7aca4 commit 563fb40
Showing 1 changed file with 24 additions and 11 deletions.
35 changes: 24 additions & 11 deletions src/cameracapture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -670,17 +670,30 @@ int CameraCapture::saveControlValue(v4l2_queryctrl &queryctrl, rapidjson::Pretty
return 0;
}

get(queryctrl.id, value);
writer.StartObject();
writer.Key("id");
writer.Int(queryctrl.id);
writer.Key("name");
writer.String(reinterpret_cast<char const *>(queryctrl.name));
writer.Key("type");
writer.Int(queryctrl.type);
writer.Key("value");
writer.Int(value);
writer.EndObject();
try {
get(queryctrl.id, value);
writer.StartObject();
writer.Key("id");
writer.Int(queryctrl.id);
writer.Key("name");
writer.String(reinterpret_cast<char const *>(queryctrl.name));
writer.Key("type");
writer.Int(queryctrl.type);
writer.Key("value");
writer.Int(value);
writer.EndObject();
}
catch (CameraException e) {
switch (e.error_code)
{
// Skip invalid arguments (nonexistant properties);
// they were uncaught and unchecked at that point
case EINVAL:
break;
default:
throw CameraException("Error occured while collecting data for the writer, please check your camera settings and try again", e.error_code);
}
}
}
else
{
Expand Down

0 comments on commit 563fb40

Please sign in to comment.