wxString iterators can't be dereferenced once they reach the end of the string, so compare them with end rather than checking if the value they point to is non-NUL. This makes wxFTP::Pwd() actually work, which was apparently broken since quite some time (perhaps ever sincec9f78968619+ years ago). See #17679. (cherry picked from commitd0c57dbef0)