summaryrefslogtreecommitdiffstats
path: root/src/widgets/util/qcolormap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/util/qcolormap.cpp')
-rw-r--r--src/widgets/util/qcolormap.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/widgets/util/qcolormap.cpp b/src/widgets/util/qcolormap.cpp
index 03ee8a395e..decfd7bd2c 100644
--- a/src/widgets/util/qcolormap.cpp
+++ b/src/widgets/util/qcolormap.cpp
@@ -66,7 +66,12 @@ static QColormapPrivate *screenMap = 0;
void QColormap::initialize()
{
screenMap = new QColormapPrivate;
-
+ if (!QGuiApplication::primaryScreen()) {
+ qWarning("no screens available, assuming 24-bit color");
+ screenMap->depth = 24;
+ screenMap->mode = QColormap::Direct;
+ return;
+ }
screenMap->depth = QGuiApplication::primaryScreen()->depth();
if (screenMap->depth < 8) {
screenMap->mode = QColormap::Indexed;