Skip to content

fixes of obvious code mistakes#1071

Merged
mjbvz merged 1 commit intomicrosoft:masterfrom
DamirAinullin:master
Jun 20, 2016
Merged

fixes of obvious code mistakes#1071
mjbvz merged 1 commit intomicrosoft:masterfrom
DamirAinullin:master

Conversation

@DamirAinullin
Copy link
Copy Markdown
Contributor

fixes of some simple obvious code mistakes and warnings.

@msftclas
Copy link
Copy Markdown

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;

(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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

3 participants