From befbaa0c61876c3bfebe29499fd16930db400b2b Mon Sep 17 00:00:00 2001 From: Trond Kjernaasen Date: Fri, 16 Apr 2010 13:10:51 +0200 Subject: 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 --- src/gui/painting/qprintengine_win.cpp | 7 ++++--- 1 file 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); } } -- cgit v0.12