Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 309ff6e

Browse files
committed
Don't break loop on NullReferenceException. ...
Without this, the exception is caught in the PopulateWithSqlReader function and terminates the loop, leaving all columns that appear after the problematic column to their default values. We catch the NullReferenceException when we attempt to set the value instead of allowing it to propagate to the column loop so that only the problematic column will be left inept.
1 parent 80124db commit 309ff6e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/ServiceStack.OrmLite/FieldDefinition.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,13 @@ public void SetValue(object onInstance, object withValue)
6262
if (this.SetValueFn == null) return;
6363

6464
var convertedValue = OrmLiteConfig.DialectProvider.ConvertDbValue(withValue, this.FieldType);
65-
SetValueFn(onInstance, convertedValue);
65+
try
66+
{
67+
SetValueFn(onInstance, convertedValue);
68+
}
69+
catch (NullReferenceException ex)
70+
{
71+
}
6672
}
6773

6874
public string GetQuotedValue(object fromInstance)

0 commit comments

Comments
 (0)