[gnome-games] savestates-list: Type-check list rows before casting



commit 1a6131612ecac5ccfa64fb4fe55220e3865821bb
Author: Yetizone <andreii lisita gmail com>
Date:   Thu Aug 15 00:04:01 2019 +0300

    savestates-list: Type-check list rows before casting
    
    Avoid casting the new savestate row to SavestateListBoxRow, preventing
    runtime errors.
    
    Fixes https://gitlab.gnome.org/GNOME/gnome-games/issues/224

 src/ui/savestates-list.vala | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/src/ui/savestates-list.vala b/src/ui/savestates-list.vala
index 35847c63..8b3ad6f3 100644
--- a/src/ui/savestates-list.vala
+++ b/src/ui/savestates-list.vala
@@ -196,6 +196,9 @@ private class Games.SavestatesList : Gtk.Box {
                }
 
                foreach (var list_child in list_box.get_children ()) {
+                       if (!(list_child is SavestateListBoxRow))
+                               continue; // Ignore the new savestate row;
+
                        var savestate_row = list_child as SavestateListBoxRow;
                        var savestate = savestate_row.savestate;
 


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