Skip to content

Commit

Permalink
Merge pull request #9430 from xoofx/fix-csharp-fielddesc-ispacked
Browse files Browse the repository at this point in the history
Fixes NullReferenceException when accessing FieldDescriptor.IsPacked
  • Loading branch information
deannagarcia committed Jan 31, 2022
2 parents 15add1a + 1694142 commit c756e61
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs
Expand Up @@ -247,7 +247,8 @@ public bool IsPacked
}
else
{
return !Proto.Options.HasPacked || Proto.Options.Packed;
// Packed by default with proto3
return Proto.Options == null || !Proto.Options.HasPacked || Proto.Options.Packed;
}
}
}
Expand Down

0 comments on commit c756e61

Please sign in to comment.