File tree 1 file changed +13
-7
lines changed
1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -574,12 +574,18 @@ impl MemController {
574
574
// for v2
575
575
pub fn get_mem ( & self ) -> Result < SetMemory > {
576
576
let mut m: SetMemory = Default :: default ( ) ;
577
- self . get_max_value ( "memory.high" )
578
- . map ( |x| m. high = Some ( x) ) ?;
579
- self . get_max_value ( "memory.low" ) . map ( |x| m. low = Some ( x) ) ?;
580
- self . get_max_value ( "memory.max" ) . map ( |x| m. max = Some ( x) ) ?;
581
- self . get_max_value ( "memory.min" ) . map ( |x| m. min = Some ( x) ) ?;
582
-
577
+ m. high = self
578
+ . get_max_value ( "memory.high" )
579
+ . map_or ( Some ( MaxValue :: Value ( 0 ) ) , |x| Some ( x) ) ;
580
+ m. low = self
581
+ . get_max_value ( "memory.low" )
582
+ . map_or ( Some ( MaxValue :: Value ( 0 ) ) , |x| Some ( x) ) ;
583
+ m. max = self
584
+ . get_max_value ( "memory.max" )
585
+ . map_or ( Some ( MaxValue :: Value ( 0 ) ) , |x| Some ( x) ) ;
586
+ m. min = self
587
+ . get_max_value ( "memory.min" )
588
+ . map_or ( Some ( MaxValue :: Value ( 0 ) ) , |x| Some ( x) ) ;
583
589
Ok ( m)
584
590
}
585
591
@@ -730,7 +736,7 @@ impl MemController {
730
736
. open_path ( "memory.swap.events" , false )
731
737
. and_then ( flat_keyed_to_hashmap)
732
738
. map ( |x| * x. get ( "fail" ) . unwrap_or ( & 0 ) as u64 )
733
- . unwrap ( ) ,
739
+ . unwrap_or ( 0 ) ,
734
740
limit_in_bytes : self
735
741
. open_path ( "memory.swap.max" , false )
736
742
. and_then ( read_i64_from)
You can’t perform that action at this time.
0 commit comments