Skip to content

ESP8266WiFiMulti.cpp code inspection: Unexecutable code in ESP8266WiFiMulti::run #2188

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

Closed
SteveToulouse opened this issue Jun 24, 2016 · 3 comments

Comments

@SteveToulouse
Copy link
Contributor

SteveToulouse commented Jun 24, 2016

While looking through the code to understand what's being done and see how issue #2117 could be resolved, lines 51 to 63 caught my eye.

The conditions of the "if"s at lines L51 if (scanResult > 0) and L61 if (scanResult <= 0) are mutually exclusive. So the code at line 62 can never be executed. Unless I've missed something?

Not a bug as such (it doesn't break anything) but it adds complexity when reading the code. The enormous "else" clause, from 63 onwards to nearly the end of ::run, could be reduced one indentation level.

EDIT This was introduced by the commit 9a1ff7f

@devyte
Copy link
Collaborator

devyte commented Oct 16, 2017

Code reference is still present in latest git. Most likely this
if (scanResult <= 0)
should be
if (scanResult == 0)

@devyte
Copy link
Collaborator

devyte commented Nov 20, 2017

@SteveToulouse please take a look at the referenced PR.

@devyte
Copy link
Collaborator

devyte commented Nov 21, 2017

I merged the PR after some sanity checks. Any new problems will be handled in a different issue.
Closing.

@devyte devyte closed this as completed Nov 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants