* Avoid null pointer reference if configuration dialog is canceled
(fixes #5988). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36809 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
1c47e8e40c
commit
13dfd6ccca
@ -77,13 +77,15 @@ HPJetDirectPort::HPJetDirectPort(BDirectory* printer, BMessage *msg)
|
||||
} else {
|
||||
BAlert *alert = new BAlert("", "Can't connect to HP JetDirect printer port!", "OK");
|
||||
alert->Go();
|
||||
fReady = B_ERROR;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
HPJetDirectPort::~HPJetDirectPort()
|
||||
{
|
||||
fEndpoint->Close();
|
||||
if (fEndpoint)
|
||||
fEndpoint->Close();
|
||||
delete fEndpoint;
|
||||
}
|
||||
|
||||
@ -92,7 +94,9 @@ ssize_t
|
||||
HPJetDirectPort::Read(void* buffer, size_t size)
|
||||
{
|
||||
// printf("HPJetDirectPort::Read(%ld bytes)\n", size);
|
||||
return (ssize_t) fEndpoint->Receive(buffer, size);
|
||||
if (fEndpoint)
|
||||
return (ssize_t) fEndpoint->Receive(buffer, size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -100,6 +104,8 @@ ssize_t
|
||||
HPJetDirectPort::Write(const void* buffer, size_t size)
|
||||
{
|
||||
// printf("HPJetDirectPort::Write(%ld bytes)\n", size);
|
||||
return (ssize_t) fEndpoint->Send(buffer, size);
|
||||
if (fEndpoint)
|
||||
return (ssize_t) fEndpoint->Send(buffer, size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user