jinganix / enif_protobuf

A Google Protobuf implementation with enif (Erlang nif)
38 stars 21 forks source link

Always select zero field for the default enum value #36

Closed Thomas-Neill closed 2 years ago

Thomas-Neill commented 2 years ago

This diff changes the code for selecting a default enum value to always choose the field assigned to zero. It's not always correct to choose the default field by comparing the ERL_NIF_TERMs for the field names because this depends on the order the atoms were first used. This isn't a major change, but should reduce the potential for strange bugs. Thanks!