Skip to content

Commit

Permalink
fix: NullReferenceException when querying missing components (#308)
Browse files Browse the repository at this point in the history
Closes: #290
  • Loading branch information
bdunderscore authored Aug 4, 2024
1 parent a9033de commit 6142778
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed
- [#298] Fixed issue where the scene view was sometimes not refreshed when the pipeline build completes
- [#309] NullReferenceException from GetParametersForObject when encountering a missing component

### Changed

Expand Down
6 changes: 5 additions & 1 deletion Editor/EnhancerDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ internal class EnhancerDatabase<T, Interface> where T : Attribute

private EnhancerDatabase()
{
_resolved = new Dictionary<Type, EnhancerDatabase<T, Interface>.Creator>();
_resolved = new Dictionary<Type, Creator>();
}


Expand Down Expand Up @@ -89,6 +89,10 @@ public static bool Query(Component c, out Interface iface)

private bool DoQuery(Component c, out Creator creator)
{
creator = default;

if (c == null) return false;

if (_resolved.TryGetValue(c.GetType(), out creator))
{
return true;
Expand Down

0 comments on commit 6142778

Please sign in to comment.