Skip to content

Commit

Permalink
fix: stopping exception if rpc name does not contain dot (#3)
Browse files Browse the repository at this point in the history
Name may not be `class.method` if `INetworkInfoProvider` doesn't return it in that format. This is mostly a safety check just incase because `INetworkInfoProvider` should return `class.method` where possible
  • Loading branch information
GoToNightmare authored and James-Frowen committed Sep 8, 2022
1 parent 6d3dfbf commit 4f7a1bd
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions Assets/Mirage.Profiler/Editor/Messages/Columns.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,19 @@ private string RpcShortName(string fullName)
if (string.IsNullOrEmpty(fullName))
return string.Empty;

var split = fullName.Split('.');
var count = split.Length;
// full name should be atleast "className.methodName"
Debug.Assert(count >= 2);

return $"{split[count - 2]}.{split[count - 1]}";
const char separator = '.';

if (fullName.Contains(separator))
{
var split = fullName.Split(separator);
var count = split.Length;
if (count >= 2)
{
return $"{split[count - 2]}.{split[count - 1]}";
}
}

return fullName;
}


Expand Down

0 comments on commit 4f7a1bd

Please sign in to comment.