@@ -442,16 +442,19 @@ impl MainWindow {
442
442
// Add to list of pages
443
443
let mut gpu_page_list: RefMut < Vec < GpuPage > > = self . gpu_pages . borrow_mut ( ) ;
444
444
gpu_page_list. push ( new_page) ;
445
- let new_page_ref: & GpuPage = gpu_page_list. last ( ) . expect ( "COULD NOT FETCH GPU PAGE REF" ) ;
446
-
447
- // Create scrollable container
448
- let scrolled_window: ScrolledWindow = ScrolledWindow :: new ( ) ;
449
- scrolled_window. set_hscrollbar_policy ( PolicyType :: Never ) ;
450
- scrolled_window. set_vscrollbar_policy ( PolicyType :: Automatic ) ;
451
- scrolled_window. set_child ( Some ( new_page_ref) ) ;
452
-
453
- // Append new ListBoxRow object to GtkListBox
454
- self . gpu_stack . add_titled ( & scrolled_window, Some ( uuid) , name) ;
445
+ match gpu_page_list. last ( ) {
446
+ Some ( new_page_ref) => {
447
+ // Create scrollable container
448
+ let scrolled_window: ScrolledWindow = ScrolledWindow :: new ( ) ;
449
+ scrolled_window. set_hscrollbar_policy ( PolicyType :: Never ) ;
450
+ scrolled_window. set_vscrollbar_policy ( PolicyType :: Automatic ) ;
451
+ scrolled_window. set_child ( Some ( new_page_ref) ) ;
452
+
453
+ // Append new ListBoxRow object to GtkListBox
454
+ self . gpu_stack . add_titled ( & scrolled_window, Some ( uuid) , name) ;
455
+ } ,
456
+ None => panic ! ( "COULD NOT FETCH GPU PAGE REF" ) ,
457
+ }
455
458
}
456
459
457
460
/**
@@ -472,8 +475,7 @@ impl MainWindow {
472
475
*/
473
476
#[ template_callback]
474
477
fn refresh_cards ( & self , _button : & Button ) {
475
- //TEST
476
- println ! ( "GPU Scan Button Pressed!" ) ;
478
+ println ! ( "GPU Scan Button Pressed!" ) ; //TEST
477
479
478
480
// Clear current ActionRow objects from GtkListBox
479
481
let mut done: bool = false ;
0 commit comments