Skip to content

Commit

Permalink
fix: crash in threads_get_public_archived
Browse files Browse the repository at this point in the history
  • Loading branch information
braindigitalis committed Oct 12, 2024
1 parent 6134d8d commit ad8d0b8
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/dpp/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@ thread& thread::fill_from_json_impl(json* j) {
set_int8_not_null(j, "member_count", this->member_count);
set_bool_not_null(j, "newly_created", this->newly_created);

auto json_metadata = (*j)["thread_metadata"];
metadata.archived = bool_not_null(&json_metadata, "archived");
metadata.archive_timestamp = ts_not_null(&json_metadata, "archive_timestamp");
metadata.auto_archive_duration = int16_not_null(&json_metadata, "auto_archive_duration");
metadata.locked = bool_not_null(&json_metadata, "locked");
metadata.invitable = bool_not_null(&json_metadata, "invitable");
if (j->contains("thread_metadata")) {
auto json_metadata = (*j)["thread_metadata"];
metadata.archived = bool_not_null(&json_metadata, "archived");
metadata.archive_timestamp = ts_not_null(&json_metadata, "archive_timestamp");
metadata.auto_archive_duration = int16_not_null(&json_metadata, "auto_archive_duration");
metadata.locked = bool_not_null(&json_metadata, "locked");
metadata.invitable = bool_not_null(&json_metadata, "invitable");
}

/* Only certain events set this */
if (j->contains("member")) {
Expand Down

0 comments on commit ad8d0b8

Please sign in to comment.