Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DPL: Catch exception from stol when parsing invalid run number #8593

Merged
merged 1 commit into from
Apr 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Detectors/TPC/workflow/src/ProcessingHelpers.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ uint64_t processing_helpers::getRunNumber(ProcessingContext& pc)
auto runNStr = pc.services().get<RawDeviceService>().device()->fConfig->GetProperty<std::string>("runNumber", NAStr);
if (runNStr != NAStr) {
size_t nc = 0;
auto runNProp = std::stol(runNStr, &nc);
long runNProp = 0;
try {
runNProp = std::stol(runNStr, &nc);
} catch (...) {
nc = (size_t)-1; // makes the next check fail if stol throws when it cannot parse the number
}
if (nc != runNStr.size()) {
LOGP(error, "Property runNumber={} is provided but is not a number, ignoring", runNStr);
} else {
Expand Down