File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ pub struct DMI {
3636 baseboard : Baseboard ,
3737 chassis : Chassis ,
3838 memory : Memory ,
39- battery : Battery ,
39+ battery : Option < Battery > ,
4040 pub focused_section : FocusedSection ,
4141}
4242
@@ -199,7 +199,7 @@ impl DMI {
199199 baseboard : baseboard. unwrap ( ) ,
200200 chassis : chassis. unwrap ( ) ,
201201 memory : memory. unwrap ( ) ,
202- battery : battery . unwrap ( ) ,
202+ battery,
203203 focused_section : FocusedSection :: Firmware ,
204204 } )
205205 }
@@ -344,7 +344,9 @@ impl DMI {
344344 self . memory . render ( frame, section_block) ;
345345 }
346346 FocusedSection :: Battery => {
347- self . battery . render ( frame, section_block) ;
347+ if let Some ( battery) = & self . battery {
348+ battery. render ( frame, section_block) ;
349+ }
348350 }
349351 }
350352 }
You can’t perform that action at this time.
0 commit comments