Skip to content

Commit

Permalink
main: abort if offset is unset
Browse files Browse the repository at this point in the history
  • Loading branch information
cyanreg committed May 2, 2023
1 parent ef653cf commit 04d84d3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/cyanrip_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1292,6 +1292,7 @@ int main(int argc, char **argv)
char *track_metadata_ptr[198] = { NULL };
int track_metadata_ptr_cnt = 0;
int find_drive_offset_range = 0;
int offset_set = 0;

CRIPArt cover_arts[32] = { 0 };
int nb_cover_arts = 0;
Expand Down Expand Up @@ -1383,6 +1384,7 @@ int main(int argc, char **argv)
int sign = settings.offset < 0 ? -1 : +1;
int frames = ceilf(abs(settings.offset)/(float)(CDIO_CD_FRAMESIZE_RAW >> 2));
settings.over_under_read_frames = sign*frames;
offset_set = 1;
break;
case 'N':
settings.disable_mb = 1;
Expand Down Expand Up @@ -1626,6 +1628,12 @@ int main(int argc, char **argv)
if (cyanrip_ctx_init(&ctx, &settings))
return 1;

if (!settings.offset && !offset_set &&
!find_drive_offset_range && (ctx->rcap & CDIO_DRIVE_CAP_READ_ISRC)) {
cyanrip_log(ctx, 0, "Offset is unset! To continue with an offset of 0, run with -s 0!\n");
goto end;
}

/* Fill disc MCN */
crip_fill_mcn(ctx);

Expand Down

0 comments on commit 04d84d3

Please sign in to comment.