RemoteMessage: Guard against NULL source/target.
To make it more obvious in case it is ever used the wrong way.
This commit is contained in:
@@ -228,7 +228,7 @@ RemoteHWInterface::_EventThreadEntry(void* data)
|
|||||||
status_t
|
status_t
|
||||||
RemoteHWInterface::_EventThread()
|
RemoteHWInterface::_EventThread()
|
||||||
{
|
{
|
||||||
RemoteMessage message(fReceiveBuffer, fSendBuffer);
|
RemoteMessage message(fReceiveBuffer, NULL);
|
||||||
while (true) {
|
while (true) {
|
||||||
uint16 code;
|
uint16 code;
|
||||||
status_t result = message.NextMessage(code);
|
status_t result = message.NextMessage(code);
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ RemoteMessage::Start(uint16 code)
|
|||||||
inline status_t
|
inline status_t
|
||||||
RemoteMessage::Flush()
|
RemoteMessage::Flush()
|
||||||
{
|
{
|
||||||
if (fWriteIndex == 0)
|
if (fWriteIndex == 0 || fTarget == NULL)
|
||||||
return B_NO_INIT;
|
return B_NO_INIT;
|
||||||
|
|
||||||
uint32 length = fWriteIndex;
|
uint32 length = fWriteIndex;
|
||||||
@@ -304,6 +304,9 @@ RemoteMessage::Read(T& value)
|
|||||||
if (fDataLeft < sizeof(T))
|
if (fDataLeft < sizeof(T))
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
|
if (fSource == NULL)
|
||||||
|
return B_NO_INIT;
|
||||||
|
|
||||||
int32 readSize = fSource->Read(&value, sizeof(T));
|
int32 readSize = fSource->Read(&value, sizeof(T));
|
||||||
if (readSize < 0)
|
if (readSize < 0)
|
||||||
return readSize;
|
return readSize;
|
||||||
|
|||||||
Reference in New Issue
Block a user