2019-09-27 Fred Gleason <fredg@paravelsystems.com>

* Fixed a bug in rdimport(1) that caused it to throw an exception
	when given a '--metadata-pattern' of less than three characters.
This commit is contained in:
Fred Gleason 2019-09-27 12:30:03 -04:00
parent cc3dc06b4a
commit bfee1c8440
2 changed files with 19 additions and 3 deletions

View File

@ -19122,3 +19122,6 @@
2019-09-25 Fred Gleason <fredg@paravelsystems.com> 2019-09-25 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in rddbmgr(8) that caused a segfault when processing * Fixed a bug in rddbmgr(8) that caused a segfault when processing
a SQL error. a SQL error.
2019-09-27 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in rdimport(1) that caused it to throw an exception
when given a '--metadata-pattern' of less than three characters.

View File

@ -1628,14 +1628,26 @@ bool MainObject::RunPattern(const QString &pattern,const QString &filename,
QTime time; QTime time;
QDate date; QDate date;
//
// Sanity Check
//
if(pattern.length()<2) {
return false;
}
// //
// Initialize Pattern Parser // Initialize Pattern Parser
// //
if((pattern.at(0)=='%')&&(pattern.at(1)!='%')) { if((pattern.at(0)=='%')&&(pattern.at(1)!='%')) {
field=pattern.at(1); field=pattern.at(1);
value=""; value="";
delimiter=pattern.at(2); if(pattern.length()>=3) {
ptr=3; delimiter=pattern.at(2);
ptr=3;
}
else {
ptr=2;
}
macro_active=true; macro_active=true;
} }
else { else {
@ -1645,7 +1657,8 @@ bool MainObject::RunPattern(const QString &pattern,const QString &filename,
for(int i=0;i<=filename.length();i++) { for(int i=0;i<=filename.length();i++) {
if(macro_active) { if(macro_active) {
if((filename.at(i)==delimiter)||(i==filename.length())) { if(((!delimiter.isNull())&&(filename.at(i)==delimiter))||
(i==filename.length())) {
switch(field.toAscii()) { switch(field.toAscii()) {
case 'a': case 'a':
wavedata->setArtist(value); wavedata->setArtist(value);