If there is no valid scanout, return NULL.

Signed-off-by: Marc-André Lureau <marcandre.lur...@gmail.com>
---
 src/channel-display.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/channel-display.c b/src/channel-display.c
index 2c54df7..90d155e 100644
--- a/src/channel-display.c
+++ b/src/channel-display.c
@@ -532,7 +532,7 @@ void 
spice_display_change_preferred_compression(SpiceChannel *channel, gint comp
  * spice_display_get_gl_scanout:
  * @channel: a #SpiceDisplayChannel
  *
- * Returns: the current GL scanout
+ * Returns: the current GL scanout, or %NULL if none or not valid
  *
  * Since: 0.31
  **/
@@ -541,7 +541,7 @@ spice_display_get_gl_scanout(SpiceDisplayChannel *channel)
 {
     g_return_val_if_fail(SPICE_IS_DISPLAY_CHANNEL(channel), NULL);
 
-    return &channel->priv->scanout;
+    return channel->priv->scanout.fd != -1 ? &channel->priv->scanout : NULL;
 }
 
 /* ------------------------------------------------------------------ */
-- 
2.5.0

_______________________________________________
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel

Reply via email to