Skip to content
Closed
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
16 changes: 12 additions & 4 deletions src/canonmn_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2714,8 +2714,12 @@ std::ostream& CanonMakerNote::print0x0008(std::ostream& os, const Value& value,
}

std::ostream& CanonMakerNote::print0x000a(std::ostream& os, const Value& value, const ExifData*) {
uint32_t l = std::stoul(value.toString());
return os << stringFormat("{:04x}{:05}", (l >> 16) & 0xFFFF, l & 0xFFFF);
try {
uint32_t l = std::stoul(value.toString());
return os << stringFormat("{:04x}{:05}", (l >> 16) & 0xFFFF, l & 0xFFFF);
} catch (const std::logic_error&) {
return os << value;
}
}

std::ostream& CanonMakerNote::print0x000c(std::ostream& os, const Value& value, const ExifData* exifData) {
Expand All @@ -2727,8 +2731,12 @@ std::ostream& CanonMakerNote::print0x000c(std::ostream& os, const Value& value,
auto pos = exifData->findKey(key);
// if model is EOS D30
if (pos != exifData->end() && pos->value().count() == 1 && pos->value().toInt64() == 0x01140000) {
uint32_t l = std::stoul(value.toString());
return os << stringFormat("{:04x}{:05}", (l >> 16) & 0xFFFF, l & 0xFFFF);
try {
uint32_t l = std::stoul(value.toString());
return os << stringFormat("{:04x}{:05}", (l >> 16) & 0xFFFF, l & 0xFFFF);
} catch (const std::logic_error&) {
return os << value;
}
}
return os << value;
}
Expand Down
Loading