Skip to content

Commit

Permalink
Check for stoi out_of_range then convert header value to long
Browse files Browse the repository at this point in the history
  • Loading branch information
pford committed Apr 16, 2024
1 parent f17756b commit 2c37de0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/ImageData/CompressedFits.cc
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,10 @@ void CompressedFits::AddHeaderEntry(
} catch (std::invalid_argument) {
// Set string value only
entry->set_entry_type(CARTA::EntryType::STRING);
} catch (std::out_of_range) {
long lvalue = std::stol(value);
entry->set_numeric_value(lvalue);
entry->set_entry_type(CARTA::EntryType::INT);
}
}
}
Expand Down

0 comments on commit 2c37de0

Please sign in to comment.