Skip to content

Commit

Permalink
Fix bug with size variable's value not being set when map is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
programmingkidx committed Dec 18, 2023
1 parent e468a64 commit 2ae96a8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion objc/type_convertion.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ dict to_c_items(void* ptr) {
dict c_dict;
NSArray * keys = [result_ allKeys];
int size = [keys count];
c_dict.len = size;
if (size > 0) {
void** key_data = malloc(size * sizeof(void*));
void** value_data = malloc(size * sizeof(void*));
Expand All @@ -76,7 +77,6 @@ dict to_c_items(void* ptr) {
}
c_dict.key_data = key_data;
c_dict.value_data = value_data;
c_dict.len = size;
}
return c_dict;
}
Expand Down

0 comments on commit 2ae96a8

Please sign in to comment.