When handling a WouldChangeOwningShard error for a retryable write, we make a call to the ClusterWriter. In the case that we receive a transient transaction error, we bypass filling the BatchedCommandResponse object and its writeErrorDetails variable.
Error handling in the WouldChangeOwningShard path assumes that the writeErrorDetails variable will be filled. But in this case, it will be a null pointer and will cause a segmentation fault. We should instead check if _writeErrorDetails exists, and if not, create it before populating the variable with the error status.