UnitGenerator icon indicating copy to clipboard operation
UnitGenerator copied to clipboard

Null exception on GetHashCode when adding a null string-based unit into a HashSet or as a key of a Dictionary.

Open vitaliano-fortis opened this issue 1 year ago • 0 comments

It seems a null check is needed here: https://github.com/Cysharp/UnitGenerator/blob/ad84e766a282e070dcd6c5554eed4825abc1ced1/src/UnitGenerator/SourceGenerator.cs#L476

I suggest using something like: return value?.GetHashCode() ?? 0;.

Thank you for the great work!

vitaliano-fortis avatar Oct 25 '24 19:10 vitaliano-fortis