@@ -293,7 +293,7 @@ std::pair<SystemInfo *, Status> RouterClient::retrievePeerInfo() {
293293
294294std::pair<IpConfig *, Status> RouterClient::retrieveIpConfig () {
295295 if (state != State::PEER_INFO_RECEIVED) {
296- Status st = Status (1 , " The client needs to receive all the peer info before receiving IP info" );
296+ Status st = Status (1 , " The client needs to receive all the peer infos before receiving IP info" );
297297 return std::make_pair (nullptr , st);
298298 }
299299
@@ -302,7 +302,7 @@ std::pair<IpConfig *, Status> RouterClient::retrieveIpConfig() {
302302
303303 if (readFromSocket (sock, data) == -1 ) {
304304 disconnect ();
305- Status st = Status (1 , std::string (" Error while receiving the peer info: " ) + strerror (errno));
305+ Status st = Status (1 , std::string (" Error while receiving the IP info: " ) + strerror (errno));
306306 return std::make_pair (nullptr , st);
307307 }
308308 msg = wire::GetMessage (data.data ());
@@ -376,7 +376,7 @@ std::pair<Transaction *, Status> RouterClient::receiveTransaction() {
376376
377377 if (readFromSocket (sock, data) == -1 ) {
378378 disconnect ();
379- Status st = Status (1 , std::string (" Error while receiving the peer info : " ) + strerror (errno));
379+ Status st = Status (1 , std::string (" Error while receiving a transaction : " ) + strerror (errno));
380380 return std::make_pair (nullptr , st);
381381 }
382382 msg = wire::GetMessage (data.data ());
@@ -416,8 +416,11 @@ std::pair<Transaction *, Status> RouterClient::receiveTransaction() {
416416 txn->id = msg->txn ()->id ();
417417 txn->address = msg->txn ()->address ();
418418 txn->size = msg->txn ()->size ();
419- txn->data .resize (msg->txn ()->data ()->size ());
420- memcpy (txn->data .data (), msg->txn ()->data ()->Data (), msg->txn ()->data ()->size ());
419+
420+ if (msg->txn ()->data ()) {
421+ txn->data .resize (msg->txn ()->data ()->size ());
422+ memcpy (txn->data .data (), msg->txn ()->data ()->Data (), msg->txn ()->data ()->size ());
423+ }
421424 txn->ok = msg->txn ()->ok ();
422425 txn->message = msg->txn ()->message ()->str ();
423426
0 commit comments