gtkmenu: Fix potential use of uninitialised variables

The child_height out variable is only valid if compute_child_offset()
returns TRUE.

Found by scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=712760
This commit is contained in:
Philip Withnall 2013-11-20 17:31:28 +00:00
parent 480a005039
commit a265d8f32d

View File

@ -5414,9 +5414,9 @@ gtk_menu_real_move_scroll (GtkMenu *menu,
{
gint child_height;
compute_child_offset (menu, menu_shell->priv->active_menu_item,
&child_offset, &child_height, NULL);
child_offset += child_height / 2;
if (compute_child_offset (menu, menu_shell->priv->active_menu_item,
&child_offset, &child_height, NULL))
child_offset += child_height / 2;
}
menu_shell->priv->ignore_enter = TRUE;