summaryrefslogtreecommitdiff
path: root/kms++
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2016-06-20 08:46:57 +0300
committerTomi Valkeinen <tomi.valkeinen@ti.com>2016-06-20 08:46:57 +0300
commit33c98598a79b8cd15ded9c91b0bc580fe1ed6fb9 (patch)
tree0cf6630dcd162b20d3256183d2945bec6d79d50a /kms++
parent365091ec413d8814b38d183adb7f0d0ee1109cbe (diff)
Framebuffer: don't crash is drmModeGetFB() returns 0
Diffstat (limited to 'kms++')
-rw-r--r--kms++/src/framebuffer.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/kms++/src/framebuffer.cpp b/kms++/src/framebuffer.cpp
index 1ce8f2a..39c4e16 100644
--- a/kms++/src/framebuffer.cpp
+++ b/kms++/src/framebuffer.cpp
@@ -23,10 +23,14 @@ Framebuffer::Framebuffer(Card& card, uint32_t id)
{
auto fb = drmModeGetFB(card.fd(), id);
- m_width = fb->width;
- m_height = fb->height;
-
- drmModeFreeFB(fb);
+ if (fb) {
+ m_width = fb->width;
+ m_height = fb->height;
+
+ drmModeFreeFB(fb);
+ } else {
+ m_width = m_height = 0;
+ }
card.m_framebuffers.push_back(this);
}