OSDN Git Service

console: allow con==NULL in dpy_{get, set}_ui_info and dpy_ui_info_supported
authorGerd Hoffmann <kraxel@redhat.com>
Tue, 8 Dec 2020 11:57:30 +0000 (12:57 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Fri, 11 Dec 2020 07:06:39 +0000 (08:06 +0100)
Use active_console in that case like we do in many other places.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-id: 20201208115737.18581-3-kraxel@redhat.com

ui/console.c

index f995639..30e70be 100644 (file)
@@ -1544,19 +1544,27 @@ static void dpy_set_ui_info_timer(void *opaque)
 
 bool dpy_ui_info_supported(QemuConsole *con)
 {
+    if (con == NULL) {
+        con = active_console;
+    }
+
     return con->hw_ops->ui_info != NULL;
 }
 
 const QemuUIInfo *dpy_get_ui_info(const QemuConsole *con)
 {
-    assert(con != NULL);
+    if (con == NULL) {
+        con = active_console;
+    }
 
     return &con->ui_info;
 }
 
 int dpy_set_ui_info(QemuConsole *con, QemuUIInfo *info)
 {
-    assert(con != NULL);
+    if (con == NULL) {
+        con = active_console;
+    }
 
     if (!dpy_ui_info_supported(con)) {
         return -1;