libkms: fix Connector::get_default_mode when no modes
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Tue, 12 Jan 2016 12:53:04 +0000 (14:53 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Tue, 12 Jan 2016 12:53:04 +0000 (14:53 +0200)
libkms++/connector.cpp

index 325b610de036fec57421d09c2f523442d580a883..e108410251bdb6814ef65e88836eb43d7dbe9b31 100644 (file)
@@ -96,6 +96,8 @@ void Connector::restore_mode()
 
 Videomode Connector::get_default_mode() const
 {
+       if (m_priv->drm_connector->count_modes == 0)
+               throw invalid_argument("no modes available\n");
        drmModeModeInfo drmmode = m_priv->drm_connector->modes[0];
 
        return drm_mode_to_video_mode(drmmode);