From 586661c0be2ffad5eea35cf2b17748407cd8f816 Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Tue, 28 Aug 2018 14:25:17 -0400 Subject: [PATCH] 2018-08-28 Fred Gleason * Fixed a bug in rdimport(1) that would throw a spurious SQL error when using the '--to-cart=' switch with an already existing cart [Issue #000217]. --- ChangeLog | 4 ++++ utils/rdimport/rdimport.cpp | 11 +++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index b8413ed0..71061d1b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16675,3 +16675,7 @@ 2018-08-28 Fred Gleason * Added support for the Spinitron v2 API in the 'spinitron_plus' RLM [Pull Request #000211]. +2018-08-28 Fred Gleason + * Fixed a bug in rdimport(1) that would throw a spurious SQL error + when using the '--to-cart=' switch with an already existing cart + [Issue #000217]. diff --git a/utils/rdimport/rdimport.cpp b/utils/rdimport/rdimport.cpp index d8218a78..e7fbcff7 100644 --- a/utils/rdimport/rdimport.cpp +++ b/utils/rdimport/rdimport.cpp @@ -1090,8 +1090,6 @@ MainObject::Result MainObject::ImportFile(const QString &filename, } if(*cartnum==0) { *cartnum=effective_group->nextFreeCart(); - } - if(*cartnum==0) { PrintLogDateTime(stderr); fprintf(stderr,"rdimport: no free carts available in specified group\n"); fflush(stderr); @@ -1114,8 +1112,13 @@ MainObject::Result MainObject::ImportFile(const QString &filename, if(import_delete_cuts) { DeleteCuts(import_cart_number); } - cart_created= - RDCart::create(effective_group->name(),RDCart::Audio,&err_msg,*cartnum)!=0; + if(RDCart::exists(*cartnum)) { + cart_created=false; + } + else { + cart_created= + RDCart::create(effective_group->name(),RDCart::Audio,&err_msg,*cartnum)!=0; + } RDCart *cart=new RDCart(*cartnum); int cutnum= cart->addCut(import_format,import_bitrate,import_channels);