Skip to content

Commit

Permalink
DeckLink disp.: user-friendly error when stoi throws
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinPulec committed Oct 12, 2023
1 parent 447f1f3 commit 22b5e66
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/video_display/decklink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1268,7 +1268,18 @@ static void *display_decklink_init(struct module *parent, const char *fmt, unsig
auto *s = new state_decklink();
s->audio_drift_fixer.set_root(get_root_module(parent));

if (!settings_init(s, fmt, cardId, &audio_consumer_levels)) {
bool succeeded = false;
try {
succeeded = settings_init(s, fmt, cardId, &audio_consumer_levels);
} catch (logic_error &e) {
if (strcmp(e.what(), "stoi") != 0 &&
strcmp(e.what(), "stod") != 0) {
throw;
}
MSG(ERROR,
"Invalid number passed where numeric argument expected!\n");
}
if (!succeeded) {
delete s;
return NULL;
}
Expand Down

0 comments on commit 22b5e66

Please sign in to comment.