aboutsummaryrefslogtreecommitdiff
path: root/objectivec/GPBMessage.m
diff options
context:
space:
mode:
authorThomas Van Lenten <thomasvl@google.com>2015-12-07 10:49:30 -0500
committerThomas Van Lenten <thomasvl@google.com>2015-12-07 10:49:30 -0500
commitc27833b6321e8c05611d659cb4bb9f60f82529a4 (patch)
treeec0c11e6e6e0d6e48c81e6a7d4ff408b7070c4eb /objectivec/GPBMessage.m
parentb1b9c254e2d1c7929f8072b82a7a0fb415ba3b75 (diff)
downloadprotobuf-c27833b6321e8c05611d659cb4bb9f60f82529a4.tar.gz
protobuf-c27833b6321e8c05611d659cb4bb9f60f82529a4.tar.bz2
protobuf-c27833b6321e8c05611d659cb4bb9f60f82529a4.zip
Enable CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION for the projects.
Diffstat (limited to 'objectivec/GPBMessage.m')
-rw-r--r--objectivec/GPBMessage.m10
1 files changed, 8 insertions, 2 deletions
diff --git a/objectivec/GPBMessage.m b/objectivec/GPBMessage.m
index c655edd3..caef584c 100644
--- a/objectivec/GPBMessage.m
+++ b/objectivec/GPBMessage.m
@@ -1212,7 +1212,8 @@ static GPBUnknownFieldSet *GetOrMakeUnknownFields(GPBMessage *self) {
NSLog(@"%@: Internal exception while building message delimitedData: %@",
[self class], exception);
#endif
- data = nil;
+ // If it happens, truncate.
+ data.length = 0;
}
[stream release];
return data;
@@ -1791,7 +1792,12 @@ static GPBUnknownFieldSet *GetOrMakeUnknownFields(GPBMessage *self) {
extensionMap_ = [[NSMutableDictionary alloc] init];
}
- [extensionMap_ setObject:value forKey:extension];
+ // This pointless cast is for CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION.
+ // Without it, the compiler complains we're passing an id nullable when
+ // setObject:forKey: requires a id nonnull for the value. The check for
+ // !value at the start of the method ensures it isn't nil, but the check
+ // isn't smart enough to realize that.
+ [extensionMap_ setObject:(id)value forKey:extension];
GPBExtensionDescriptor *descriptor = extension;