summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qprintengine_win.cpp
diff options
context:
space:
mode:
authorTrond Kjernaasen <trond@trolltech.com>2010-04-16 11:10:51 (GMT)
committerTrond Kjernaasen <trond@trolltech.com>2010-04-16 11:14:51 (GMT)
commitbefbaa0c61876c3bfebe29499fd16930db400b2b (patch)
treefd6c9ffb6f27710187c4b8fbf3e9ee52022ed13c /src/gui/painting/qprintengine_win.cpp
parentde1c505ddb5acedf96168df00172b9e3a694a32d (diff)
downloadQt-befbaa0c61876c3bfebe29499fd16930db400b2b.zip
Qt-befbaa0c61876c3bfebe29499fd16930db400b2b.tar.gz
Qt-befbaa0c61876c3bfebe29499fd16930db400b2b.tar.bz2
Fixed a crash on Windows 7 systems with invalid PrinterPorts entries.
Some Windows 7 systems appear to have invalid entries in the PrinterPorts registry key. It's supposed to contain 3 entries, but some return a single value. Task-number: QTBUG-9938 Reviewed-by: Kim
Diffstat (limited to 'src/gui/painting/qprintengine_win.cpp')
-rw-r--r--src/gui/painting/qprintengine_win.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gui/painting/qprintengine_win.cpp b/src/gui/painting/qprintengine_win.cpp
index 374bfa0..76dad72 100644
--- a/src/gui/painting/qprintengine_win.cpp
+++ b/src/gui/painting/qprintengine_win.cpp
@@ -964,12 +964,13 @@ void QWin32PrintEnginePrivate::queryDefault()
return;
QStringList info = output.split(QLatin1Char(','));
- if (info.size() > 0) {
+ int infoSize = info.size();
+ if (infoSize > 0) {
if (name.isEmpty())
name = info.at(0);
- if (program.isEmpty())
+ if (program.isEmpty() && infoSize > 1)
program = info.at(1);
- if (port.isEmpty())
+ if (port.isEmpty() && infoSize > 2)
port = info.at(2);
}
}