Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes of obvious code mistakes #1071

Merged
merged 1 commit into from
Jun 20, 2016
Merged

Conversation

DamirAinullin
Copy link
Contributor

fixes of some simple obvious code mistakes and warnings.

@msftclas
Copy link

Hi @DamirAinullin, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!

In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes. I promise there's no faxing. https://cla.microsoft.com.

TTYL, MSBOT;

@@ -152,7 +152,7 @@ public StandaloneTargetView(StandaloneTarget template)
WorkingDirectory.IndexOfAny(Path.GetInvalidPathChars()) == -1 &&
(Path.IsPathRooted(ScriptPath) || Path.IsPathRooted(WorkingDirectory)) &&
File.Exists(Path.Combine(WorkingDirectory, ScriptPath)) &&
(string.IsNullOrEmpty(WorkingDirectory) || Directory.Exists(WorkingDirectory)) &&
(WorkingDirectory == string.Empty || Directory.Exists(WorkingDirectory)) &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the behavior and some analyzers will complain about comparing to string.Empty directly. Is there a specific reason for this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use WorkingDirectory at the line 152, before check it for null. So I can suppose that check is not needed. Maybe NullReferenceException is possible at the line 152. Maybe we should check it for null before using.

@mjbvz
Copy link
Contributor

mjbvz commented Jun 20, 2016

Thanks for the fixes. Just one small comment to take a look at before we merge this in.

What tool did you use to find these?

@DamirAinullin
Copy link
Contributor Author

Thanks for positive response. I just try to help your project. I use static analyser PVS-Studio. It is a wonderful tool.

@mjbvz
Copy link
Contributor

mjbvz commented Jun 20, 2016

Thanks for details and thanks again for finding these. LGTM, merging this in now.

@mjbvz mjbvz merged commit e2f7440 into microsoft:master Jun 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants