Skip to content

Commit

Permalink
Add resolvers check in GlobalTypeMapper
Browse files Browse the repository at this point in the history
  • Loading branch information
roji committed Sep 23, 2023
1 parent 945ad65 commit aaa30f0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Npgsql/TypeMapping/GlobalTypeMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public void AddTypeInfoResolver(IPgTypeInfoResolver resolver)

// Since EFCore.PG plugins (and possibly other users) repeatedly call NpgsqlConnection.GlobalTypeMapper.UseNodaTime,
// we replace an existing resolver of the same CLR type.
if (_pluginResolvers[0].GetType() == type)
if (_pluginResolvers.Count > 0 && _pluginResolvers[0].GetType() == type)
_pluginResolvers[0] = resolver;
for (var i = 0; i < _pluginResolvers.Count; i++)
{
Expand Down

0 comments on commit aaa30f0

Please sign in to comment.