@@ -93,7 +93,7 @@ internal static Branch DeSerialize(JsonElement jsonElement, SerializationModeKin
9393 }
9494 else
9595 {
96- logger . LogDebug ( $ "the timestamp Json property was not found in the Tag : { dtoInstance . Id } ") ;
96+ logger . LogDebug ( $ "the timestamp Json property was not found in the Branch : { dtoInstance . Id } ") ;
9797 }
9898
9999 if ( jsonElement . TryGetProperty ( "description" , out JsonElement descriptionProperty ) )
@@ -111,18 +111,25 @@ internal static Branch DeSerialize(JsonElement jsonElement, SerializationModeKin
111111
112112 if ( jsonElement . TryGetProperty ( "head" , out JsonElement headProperty ) )
113113 {
114- if ( headProperty . TryGetProperty ( "@id" , out JsonElement headIdProperty ) )
114+ if ( headProperty . ValueKind == JsonValueKind . Null )
115+ {
116+ logger . LogWarning ( $ "the head Json property was null which should not be allowed: Branch { dtoInstance . Id } ") ;
117+ }
118+ else
115119 {
116- var propertyValue = headIdProperty . GetString ( ) ;
117- if ( propertyValue != null )
120+ if ( headProperty . TryGetProperty ( "@id" , out JsonElement headIdProperty ) )
118121 {
119- dtoInstance . Head = Guid . Parse ( propertyValue ) ;
122+ var propertyValue = headIdProperty . GetString ( ) ;
123+ if ( propertyValue != null )
124+ {
125+ dtoInstance . Head = Guid . Parse ( propertyValue ) ;
126+ }
120127 }
121128 }
122129 }
123130 else
124131 {
125- logger . LogDebug ( $ "the referencedCommit Json property was not found in the Tag : { dtoInstance . Id } ") ;
132+ logger . LogDebug ( $ "the referencedCommit Json property was not found in the Branch : { dtoInstance . Id } ") ;
126133 }
127134
128135 if ( jsonElement . TryGetProperty ( "name" , out JsonElement nameProperty ) )
@@ -163,18 +170,25 @@ internal static Branch DeSerialize(JsonElement jsonElement, SerializationModeKin
163170
164171 if ( jsonElement . TryGetProperty ( "referencedCommit" , out JsonElement referencedCommitProperty ) )
165172 {
166- if ( referencedCommitProperty . TryGetProperty ( "@id" , out JsonElement referencedCommitIdProperty ) )
173+ if ( referencedCommitProperty . ValueKind == JsonValueKind . Null )
167174 {
168- var propertyValue = referencedCommitIdProperty . GetString ( ) ;
169- if ( propertyValue != null )
175+ logger . LogWarning ( $ "the referencedCommit Json property was null which should not be allowed: Branch { dtoInstance . Id } ") ;
176+ }
177+ else
178+ {
179+ if ( referencedCommitProperty . TryGetProperty ( "@id" , out JsonElement referencedCommitIdProperty ) )
170180 {
171- dtoInstance . ReferencedCommit = Guid . Parse ( propertyValue ) ;
181+ var propertyValue = referencedCommitIdProperty . GetString ( ) ;
182+ if ( propertyValue != null )
183+ {
184+ dtoInstance . ReferencedCommit = Guid . Parse ( propertyValue ) ;
185+ }
172186 }
173187 }
174188 }
175189 else
176190 {
177- logger . LogDebug ( $ "the referencedCommit Json property was not found in the Tag : { dtoInstance . Id } ") ;
191+ logger . LogDebug ( $ "the referencedCommit Json property was not found in the Branch : { dtoInstance . Id } ") ;
178192 }
179193
180194 if ( jsonElement . TryGetProperty ( "timestamp" , out JsonElement timestampProperty ) )
0 commit comments