Skip to content

Commit

Permalink
Drive-by nullability fix in BuilderInfo._decoceEnum.
Browse files Browse the repository at this point in the history
  • Loading branch information
ignatz committed Feb 21, 2024
1 parent d5001a9 commit 68bb70d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions protobuf/lib/src/protobuf/builder_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,13 @@ class BuilderInfo {

ProtobufEnum? _decodeEnum(
int tagNumber, ExtensionRegistry? registry, int rawValue) {
var f = valueOfFunc(tagNumber);
if (f == null && registry != null) {
f = registry.getExtension(qualifiedMessageName, tagNumber)!.valueOf;
final f = valueOfFunc(tagNumber);
if (f != null) {
return f(rawValue);
}
return f!(rawValue);
return registry
?.getExtension(qualifiedMessageName, tagNumber)
?.valueOf
?.call(rawValue);
}
}

0 comments on commit 68bb70d

Please sign in to comment.