Skip to content

Commit

Permalink
Do error handling for --upscale parameter.
Browse files Browse the repository at this point in the history
  • Loading branch information
hzeller committed Sep 1, 2023
1 parent 3271ca9 commit c5635a0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/timg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,13 @@ int main(int argc, char *argv[]) {
case 'C': display_opts.center_horizontally = true; break;
case 'U':
display_opts.upscale = !display_opts.upscale;
display_opts.upscale_integer = (optarg && optarg[0] == 'i');
if (optarg) {
if (optarg[0] == 'i' || optarg[0] == 'I') {
display_opts.upscale_integer = true;
} else {
fprintf(stderr, "Invalid parameter to --upscale\n");
}
}
break;
case OPT_AUTO_CROP:
display_opts.auto_crop = true;
Expand Down

0 comments on commit c5635a0

Please sign in to comment.