summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);
}