Skip to content

Commit

Permalink
ArgumentOutOfRangeException Bugfix
Browse files Browse the repository at this point in the history
MessageDeserializer.cs::Read(out string value) threw an error as soon as NaN values were present in the points of the mesh.
Zero values were therefore given and one was subtracted from them due to ROS2 conditions.
This resulted in negative becoming in a counting variable
  • Loading branch information
NiklasDerEchte committed Jan 18, 2025
1 parent c27f00c commit 5fad75b
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public void Read(out string value)
value = System.Text.Encoding.UTF8.GetString(data, offset, length);
#else
// ROS2 strings have a null byte at the end
value = System.Text.Encoding.UTF8.GetString(data, offset, length - 1);
value = System.Text.Encoding.UTF8.GetString(data, offset, Math.Max(0, length - 1));
#endif
offset += length;
}
Expand Down

0 comments on commit 5fad75b

Please sign in to comment.