summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2010-12-10 14:33:42 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2010-12-10 14:38:21 (GMT)
commitb121ab1e4894ef8e0df5effff3a5e579675f1d40 (patch)
treeec6c2915debbac336850a140ded6e41e3b30f95f /tools
parent58334dcd3bf7c65ff910f4b00f356aa5944f2c82 (diff)
downloadQt-b121ab1e4894ef8e0df5effff3a5e579675f1d40.zip
Qt-b121ab1e4894ef8e0df5effff3a5e579675f1d40.tar.gz
Qt-b121ab1e4894ef8e0df5effff3a5e579675f1d40.tar.bz2
refuse to open empty translation files
they cause a crash. fixing it properly would be in no reasonable relation to the gain (none whatsoever), so just forbid it. yes, this breaks the message freeze ... big deal in a translation application. ;) Task-number: QTBUG-14574
Diffstat (limited to 'tools')
-rw-r--r--tools/linguist/linguist/messagemodel.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/linguist/linguist/messagemodel.cpp b/tools/linguist/linguist/messagemodel.cpp
index 39ba9fd..c2edc75 100644
--- a/tools/linguist/linguist/messagemodel.cpp
+++ b/tools/linguist/linguist/messagemodel.cpp
@@ -209,6 +209,13 @@ bool DataModel::load(const QString &fileName, bool *langGuessed, QWidget *parent
return false;
}
+ if (!tor.messageCount()) {
+ QMessageBox::warning(parent, QObject::tr("Qt Linguist"),
+ tr("The translation file '%1' will not be loaded because it is empty.")
+ .arg(Qt::escape(fileName)));
+ return false;
+ }
+
Translator::Duplicates dupes = tor.resolveDuplicates();
if (!dupes.byId.isEmpty() || !dupes.byContents.isEmpty()) {
QString err = tr("<qt>Duplicate messages found in '%1':").arg(Qt::escape(fileName));