Make Encoder:get_crtc() return 0 if no crtc
authorTomi Valkeinen <tomi.valkeinen@iki.fi>
Wed, 30 Sep 2015 18:50:14 +0000 (21:50 +0300)
committerTomi Valkeinen <tomi.valkeinen@iki.fi>
Thu, 1 Oct 2015 16:40:22 +0000 (19:40 +0300)
libkms++/encoder.cpp

index 081177b351c0b3be6d787ec199fae9dd7b2f9c3f..81eba719ff46d45772c74e96333f5fe287bc9b2c 100644 (file)
@@ -42,7 +42,10 @@ void Encoder::print_short() const
 
 Crtc* Encoder::get_crtc() const
 {
-       return card().get_crtc(m_priv->drm_encoder->crtc_id);
+       if (m_priv->drm_encoder->crtc_id)
+               return card().get_crtc(m_priv->drm_encoder->crtc_id);
+       else
+               return 0;
 }
 
 vector<Crtc*> Encoder::get_possible_crtcs() const