Skip to content

Commit

Permalink
Fix network sorting (As per #44)
Browse files Browse the repository at this point in the history
  • Loading branch information
PhracturedBlue committed Mar 27, 2018
1 parent af18f1b commit b58dd34
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/ESP8266MQTTMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,18 +398,15 @@ void ESP8266MQTTMesh::scan() {
continue;
}
}
next_ap->next = ap_ptr->next;
ap_ptr->next = next_ap;
break;
}
if (! ap_ptr) {
//Didn't insert this AP, so add it to the end;
next_ap->next = NULL;
if (ap_last) {
ap_last->next = next_ap;
} else {
ap = next_ap;
}
//Insert next_ap before ap_ptr (i.e. at last_ap)
next_ap->next = ap_ptr;
if (ap_last) {
ap_last->next = next_ap;
} else {
//ap was empty, so create it
ap = next_ap;
}
}
ap_ptr = ap;
Expand Down

0 comments on commit b58dd34

Please sign in to comment.