Commit fa3fab2c9ff032b9c2cdaf9e3e720b485354cfbb

Authored by Charles Otto
1 parent 6e96c4e0

Fix an issue with File::label remapping numeric 'subject' unnecessarily

If 'subject' is set, but 'label' is not set, before remapping subject
to an integer, check if it is already a number. In this case, no
remapping is necesasry, and in fact remapping caused problems when
evaluating regression output
Showing 1 changed file with 5 additions and 0 deletions
openbr/openbr_plugin.cpp
@@ -183,6 +183,11 @@ float File::label() const @@ -183,6 +183,11 @@ float File::label() const
183 if (s.isNull()) return -1; 183 if (s.isNull()) return -1;
184 184
185 const QString subject = s.toString(); 185 const QString subject = s.toString();
  186 +
  187 + bool is_num = false;
  188 + float num = subject.toFloat(&is_num);
  189 + if (is_num) return num;
  190 +
186 static QMutex mutex; 191 static QMutex mutex;
187 QMutexLocker mutexLocker(&mutex); 192 QMutexLocker mutexLocker(&mutex);
188 if (!Globals->subjects.contains(subject)) 193 if (!Globals->subjects.contains(subject))