[libgnomekbd/robert.ancell/libgnomekbd-no-crash-unknown-layout] gkbd-keyboard-display: Don't crash on unknown layout




commit fd718be42c71e399bd9aa7de4e6a8e01f3c14822
Author: Robert Ancell <robert ancell canonical com>
Date:   Tue Nov 13 12:00:23 2018 +1300

    gkbd-keyboard-display: Don't crash on unknown layout
    
    Previously would crash when running:
    $ gkbd-keyboard-display -l nosuchlayout

 libgnomekbd/gkbd-keyboard-drawing.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/libgnomekbd/gkbd-keyboard-drawing.c b/libgnomekbd/gkbd-keyboard-drawing.c
index 594d3a3..5d7c5ed 100644
--- a/libgnomekbd/gkbd-keyboard-drawing.c
+++ b/libgnomekbd/gkbd-keyboard-drawing.c
@@ -2129,6 +2129,10 @@ get_preferred_height_for_width (GtkWidget * widget,
                                gint * natural_height)
 {
        GkbdKeyboardDrawing *drawing = GKBD_KEYBOARD_DRAWING (widget);
+
+       if (!drawing->xkb)
+               return;
+
        *minimum_height = *natural_height =
            width * drawing->xkb->geom->height_mm /
            drawing->xkb->geom->width_mm;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]