summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qt-models/weightmodel.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/qt-models/weightmodel.cpp b/qt-models/weightmodel.cpp
index 3295e29ae..715af1571 100644
--- a/qt-models/weightmodel.cpp
+++ b/qt-models/weightmodel.cpp
@@ -99,13 +99,13 @@ bool WeightModel::setData(const QModelIndex &index, const QVariant &value, int r
if (!ws->description || gettextFromC::tr(ws->description) != vString) {
// loop over translations to see if one matches
int i = -1;
- while (ws_info[++i].name && i < MAX_WS_INFO) {
+ while (i < MAX_WS_INFO && ws_info[++i].name) {
if (gettextFromC::tr(ws_info[i].name) == vString) {
ws->description = copy_string(ws_info[i].name);
break;
}
}
- if (ws_info[i].name == NULL) // didn't find a match
+ if (i == MAX_WS_INFO || ws_info[i].name == NULL) // didn't find a match
ws->description = copy_qstring(vString);
changed = true;
}