Fixed segfault when requesting non-existant parent window
authorrodin <rodin@ddfedd41-794f-dd11-ae45-00112f111e67>
Wed, 5 May 2010 13:47:14 +0000 (13:47 +0000)
committerrodin <rodin@ddfedd41-794f-dd11-ae45-00112f111e67>
Wed, 5 May 2010 13:47:14 +0000 (13:47 +0000)
libchimara/window.c

index 011b5fbf99ee6859f45940d1ba82ddf14452d5ee..56cbd700e6d66f2a5d9b2f496073a18fcf91eb05 100644 (file)
@@ -170,7 +170,11 @@ winid_t
 glk_window_get_parent(winid_t win)
 {
        VALID_WINDOW(win, return NULL);
+
        /* Value will also be NULL if win is the root window */
+       if(win->window_node->parent == NULL)
+               return NULL;
+
        return (winid_t)win->window_node->parent->data;
 }