From 38220fb0e5bcabe06cfeec080f630c4898a515f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Mon, 2 Apr 2007 22:53:01 +0000 Subject: [PATCH] fix ServerLink::ReadShape and ServerLink::AttachShape for empty shapes git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20517 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/app/ServerLink.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/kits/app/ServerLink.cpp b/src/kits/app/ServerLink.cpp index ee843b10d8..380bc16b76 100644 --- a/src/kits/app/ServerLink.cpp +++ b/src/kits/app/ServerLink.cpp @@ -58,10 +58,12 @@ ServerLink::ReadShape(BShape *shape) fReceiver->Read(&ptCount, sizeof(int32)); uint32 opList[opCount]; - fReceiver->Read(opList, opCount * sizeof(uint32)); + if (opCount > 0) + fReceiver->Read(opList, opCount * sizeof(uint32)); BPoint ptList[ptCount]; - fReceiver->Read(ptList, ptCount * sizeof(BPoint)); + if (ptCount > 0) + fReceiver->Read(ptList, ptCount * sizeof(BPoint)); shape->SetData(opCount, ptCount, opList, ptList); return B_OK; @@ -79,8 +81,11 @@ ServerLink::AttachShape(BShape &shape) fSender->Attach(&opCount, sizeof(int32)); fSender->Attach(&ptCount, sizeof(int32)); - fSender->Attach(opList, opCount * sizeof(uint32)); - return fSender->Attach(ptList, ptCount * sizeof(BPoint)); + if (opCount > 0) + fSender->Attach(opList, opCount * sizeof(uint32)); + if (ptCount > 0) + fSender->Attach(ptList, ptCount * sizeof(BPoint)); + return B_OK; }