Skip to content

Commit af7c9d1

Browse files
authored
CSHARP-5141: Coverity analysis defect 127359: Explicit null dereferenced (#1364)
1 parent 5454035 commit af7c9d1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/MongoDB.Driver.Core/Core/Operations/BulkWriteBatchResult.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* limitations under the License.
1414
*/
1515

16+
using System;
1617
using System.Collections.Generic;
1718
using System.Linq;
1819
using MongoDB.Bson;
@@ -188,7 +189,7 @@ private static BulkWriteConcernError CreateWriteConcernError(
188189
var codeName = (string)value.GetValue("codeName", null);
189190
var message = value["errmsg"].AsString;
190191
var details = (BsonDocument)value.GetValue("errInfo", null);
191-
var errorLabels = writeConcernException.ErrorLabels;
192+
var errorLabels = writeConcernException?.ErrorLabels ?? Array.Empty<string>();
192193

193194
return new BulkWriteConcernError(code, codeName, message, details, errorLabels);
194195
}

0 commit comments

Comments
 (0)