Skip to content

Commit

Permalink
pw_rpc: Remove an edge UB case
Browse files Browse the repository at this point in the history
Not all branches assign call_id. Based on cl/501757539.

Change-Id: Id0aa67656fb1d295a2c24d268a7ab87f127bd8eb
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/126533
Pigweed-Auto-Submit: Ted Pudlik <[email protected]>
Reviewed-by: Wyatt Hepler <[email protected]>
Commit-Queue: Auto-Submit <[email protected]>
  • Loading branch information
tpudlik authored and CQ Bot Account committed Jan 14, 2023
1 parent 4b6c52d commit c4c585a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pw_rpc/raw/client_testing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,13 @@ Status FakeServer::ProcessPacket(internal::pwpb::PacketType type,
}

auto packet_encoding_result =
internal::Packet(
type, channel_id_, service_id, method_id, *call_id, payload, status)
internal::Packet(type,
channel_id_,
service_id,
method_id,
call_id.value_or(internal::Packet::kUnassignedId),
payload,
status)
.Encode(packet_buffer_);
PW_CHECK_OK(packet_encoding_result.status());
return client_.ProcessPacket(*packet_encoding_result);
Expand Down

0 comments on commit c4c585a

Please sign in to comment.