From 72d6bb9893cf8344d5c38d8d0760f08b59175905 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sat, 4 Jun 2005 11:16:21 +0000 Subject: [PATCH] Add a string regardless if a NULL pointer was passed. This fixes a fragility in the comm code, and People is now displayed correctly. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12951 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/app/LinkMsgSender.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/kits/app/LinkMsgSender.cpp b/src/kits/app/LinkMsgSender.cpp index 945cc598a0..8f0304746b 100644 --- a/src/kits/app/LinkMsgSender.cpp +++ b/src/kits/app/LinkMsgSender.cpp @@ -24,6 +24,7 @@ // Description: Class for low-overhead port-based messaging // //------------------------------------------------------------------------------ +#include #include #include #include @@ -263,10 +264,18 @@ status_t LinkMsgSender::Flush(bigtime_t timeout) status_t LinkMsgSender::AttachString(const char *string) { status_t err; - if (string == NULL) - return B_BAD_VALUE; + if (string == NULL) { +// TODO: This whole comm thing is so broken.... if we're for some +// reason attaching a NULL string, and don't do it, the receiving +// party will still try to read a string!! The whole communication +// will be messed up if the stream does not contain what the client +// things it contains. This is a quick fix (but just for this +// particular problem). -Stephan +// return B_BAD_VALUE; + string = ""; + } - int32 len = strlen(string)+1; + int32 len = strlen(string) + 1; err = Attach(len); if (err < B_OK) return err;