File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -320,11 +320,15 @@ impl MyApp {
320320 ui. vertical ( |ui| { 
321321 if  let  Ok ( gui_data)  = self . data_lock . read ( )  { 
322322 self . data  = gui_data. clone ( ) ; 
323-  self . labels  = gui_data. plots . iter ( ) . map ( |d| d. 0 . clone ( ) ) . collect ( ) ; 
324-  self . colors  = ( 0 ..max ( self . labels . len ( ) ,  1 ) ) 
325-  . map ( |i| COLORS [ i % COLORS . len ( ) ] ) 
326-  . collect ( ) ; 
327-  self . color_vals  = ( 0 ..max ( self . data . plots . len ( ) ,  1 ) ) . map ( |_| 0.0 ) . collect ( ) ; 
323+  if  self . data . plots . len ( )  != self . labels . len ( )  { 
324+  self . labels  = gui_data. plots . iter ( ) . map ( |d| d. 0 . clone ( ) ) . collect ( ) ; 
325+  } 
326+  if  self . colors . len ( )  != self . labels . len ( )  { 
327+  self . colors  = ( 0 ..max ( self . labels . len ( ) ,  1 ) ) 
328+  . map ( |i| COLORS [ i % COLORS . len ( ) ] ) 
329+  . collect ( ) ; 
330+  self . color_vals  = ( 0 ..max ( self . data . plots . len ( ) ,  1 ) ) . map ( |_| 0.0 ) . collect ( ) ; 
331+  } 
328332 } 
329333
330334 // TODO what about self.data.loaded_from_file 
                                 You can’t perform that action at this time. 
               
                  
0 commit comments