GitExtensions

Git-Logo-2Color

An expression that is always true

V3022 Expression ‘string.IsNullOrEmpty(rev1) || string.IsNullOrEmpty(rev2)’ is always true. GitUI FormFormatPatch.cs 155

string rev1 = "";
string rev2 = "";

var revisions = RevisionGrid.GetSelectedRevisions();
if (revisions.Count > 0)
{
  rev1 = ....;
  rev2 = ....;
  ....
}
else

if (string.IsNullOrEmpty(rev1) || string.IsNullOrEmpty(rev2)) 
{
    MessageBox.Show(....);
    return;
}

Having analyzed the code, we can draw the conclusion that the else statement is used by mistake here. Removing it from the specified fragment eliminates the error caused by the fact that the second check is always true.

Please click here to see more bugs from this project.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s