@@ -46,12 +46,14 @@ thread& thread::fill_from_json_impl(json* j) {
46
46
set_int8_not_null (j, " member_count" , this ->member_count );
47
47
set_bool_not_null (j, " newly_created" , this ->newly_created );
48
48
49
- auto json_metadata = (*j)[" thread_metadata" ];
50
- metadata.archived = bool_not_null (&json_metadata, " archived" );
51
- metadata.archive_timestamp = ts_not_null (&json_metadata, " archive_timestamp" );
52
- metadata.auto_archive_duration = int16_not_null (&json_metadata, " auto_archive_duration" );
53
- metadata.locked = bool_not_null (&json_metadata, " locked" );
54
- metadata.invitable = bool_not_null (&json_metadata, " invitable" );
49
+ if (j->contains (" thread_metadata" )) {
50
+ auto json_metadata = (*j)[" thread_metadata" ];
51
+ metadata.archived = bool_not_null (&json_metadata, " archived" );
52
+ metadata.archive_timestamp = ts_not_null (&json_metadata, " archive_timestamp" );
53
+ metadata.auto_archive_duration = int16_not_null (&json_metadata, " auto_archive_duration" );
54
+ metadata.locked = bool_not_null (&json_metadata, " locked" );
55
+ metadata.invitable = bool_not_null (&json_metadata, " invitable" );
56
+ }
55
57
56
58
/* Only certain events set this */
57
59
if (j->contains (" member" )) {
0 commit comments