Matter fix exception when fabrics is not initialized (#20667)

This commit is contained in:
s-hadinger 2024-02-05 11:48:07 +01:00 committed by GitHub
parent fd52aaee14
commit 2a4c59dc68
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 6 deletions

View File

@ -102,7 +102,11 @@ class Matter_Session_Store
# Count the number of commissionned fabrics, i.e. persisted
def count_active_fabrics()
self.remove_expired() # clean before
return self.fabrics.count_persistables()
if self.fabrics != nil
return self.fabrics.count_persistables()
else
return 0
end
end
#############################################################

View File

@ -508,20 +508,28 @@ be_local_closure(Matter_Session_Store_count_active_fabrics, /* name */
0, /* has sup protos */
NULL, /* no sub protos */
1, /* has constants */
( &(const bvalue[ 3]) { /* constants */
( &(const bvalue[ 4]) { /* constants */
/* K0 */ be_nested_str_weak(remove_expired),
/* K1 */ be_nested_str_weak(fabrics),
/* K2 */ be_nested_str_weak(count_persistables),
/* K3 */ be_const_int(0),
}),
be_str_weak(count_active_fabrics),
&be_const_str_solidified,
( &(const binstruction[ 6]) { /* code */
( &(const binstruction[13]) { /* code */
0x8C040100, // 0000 GETMET R1 R0 K0
0x7C040200, // 0001 CALL R1 1
0x88040101, // 0002 GETMBR R1 R0 K1
0x8C040302, // 0003 GETMET R1 R1 K2
0x7C040200, // 0004 CALL R1 1
0x80040200, // 0005 RET 1 R1
0x4C080000, // 0003 LDNIL R2
0x20040202, // 0004 NE R1 R1 R2
0x78060004, // 0005 JMPF R1 #000B
0x88040101, // 0006 GETMBR R1 R0 K1
0x8C040302, // 0007 GETMET R1 R1 K2
0x7C040200, // 0008 CALL R1 1
0x80040200, // 0009 RET 1 R1
0x70020000, // 000A JMP #000C
0x80060600, // 000B RET 1 K3
0x80000000, // 000C RET 0
})
)
);