On Tue, Jul 28, 2015 at 2:54 PM, Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> wrote:
On second thought, B_NO_INIT doesn't make any sense for BNetworkAddress. An
empty address is still a valid address (unlike a BFile object that hasn't
been initialized yet).
@@ -177,8 +177,10 @@ BNetworkAddress::SetTo(const char* host, uint16 port,
uint32 flags)
cookie = 0;
status = resolver->GetNextAddress(&cookie, *this);
- if (status == B_OK)
- fStatus = B_OK;
+ if (status != B_OK) {
+ Unset();
+ fStatus = status;
+ }
If fStatus was not B_OK, it's still not B_OK after this, but should be.
Correct would be:
fStatus = ...
if (fStatus != B_OK)
_Unset();
return fStatus;