Skip to content

Commit f2ef1c8

Browse files
committed
fix null metrics_storage
1 parent 1e05304 commit f2ef1c8

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

source/v5/mqtt5_options_storage.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,11 @@ static size_t s_aws_mqtt5_packet_connect_compute_storage_size(
649649
if (options) {
650650
size_t username_size = 0;
651651
aws_mqtt_append_sdk_metrics_to_username(
652-
aws_default_allocator(), view->username, &options->metrics_storage->storage_view, NULL, &username_size);
652+
aws_default_allocator(),
653+
view->username,
654+
options->metrics_storage ? &options->metrics_storage->storage_view : NULL,
655+
NULL,
656+
&username_size);
653657
storage_size += username_size;
654658
} else {
655659
storage_size += view->username->len;
@@ -706,7 +710,7 @@ int aws_mqtt5_packet_connect_storage_init(
706710
if (aws_mqtt_append_sdk_metrics_to_username(
707711
allocator,
708712
&username_cur,
709-
&client_storage->metrics_storage->storage_view,
713+
client_storage->metrics_storage? &client_storage->metrics_storage->storage_view : NULL,
710714
&metrics_username_buf,
711715
NULL)) {
712716
return AWS_OP_ERR;

0 commit comments

Comments
 (0)