Skip to content

Commit

Permalink
Additional null checks
Browse files Browse the repository at this point in the history
  • Loading branch information
cheenamalhotra committed Jan 26, 2021
1 parent 4586cf0 commit c881b91
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -772,13 +772,13 @@ private DbConnectionInternal CreateObject(DbConnection owningObject, DbConnectio

CheckPoolBlockingPeriod(e);

// Close Parser if connection already established.
if (newObj.IsConnectionAlive())
// Close associated Parser if connection already established.
if (newObj != null && newObj.IsConnectionAlive())
{
newObj.Dispose();
newObj = null; // set to null, so we do not return bad new object
}

newObj = null; // set to null, so we do not return bad new object
// Failed to create instance
_resError = e;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -907,12 +907,12 @@ private DbConnectionInternal CreateObject(DbConnection owningObject, DbConnectio
}

// Close associated Parser if connection already established.
if (newObj.IsConnectionAlive())
if (newObj != null && newObj.IsConnectionAlive())
{
newObj.Dispose();
newObj = null; // set to null, so we do not return bad new object
}

newObj = null; // set to null, so we do not return bad new object
// Failed to create instance
_resError = e;

Expand Down

0 comments on commit c881b91

Please sign in to comment.