Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MessageView.Sort it could lead to null reference exception bcs sortHeader parameter is null. #4

Closed
GoToNightmare opened this issue Sep 7, 2022 · 2 comments

Comments

@GoToNightmare
Copy link
Contributor

Bcs SavedData.GetSortHeader could return ColumnInfo - null in tuple

public void Sort(ColumnInfo sortHeader, SortMode sortMode)
{
var sorter = new GroupSorter(_grouped, sortHeader, sortMode);
sorter.Sort();
if (sortHeader != null)
{
// also set table names,
_table.SetSortHeader(sortHeader, sortMode);
}
}

Not sure what is the right fix.

Trace:

NullReferenceException: Object reference not set to an instance of an object
Mirage.NetworkProfiler.ModuleGUI.Messages.GroupSorter.CompareGroupSortMode (Mirage.NetworkProfiler.ModuleGUI.Messages.Group x, Mirage.NetworkProfiler.ModuleGUI.Messages.Group y) (at Assets/Mirage.Profiler/Editor/Messages/GroupSorter.cs:48)
(wrapper unbox) Mirage.NetworkProfiler.ModuleGUI.Messages.GroupSorter.CompareGroupSortMode(Mirage.NetworkProfiler.ModuleGUI.Messages.Group,Mirage.NetworkProfiler.ModuleGUI.Messages.Group)
System.Collections.Generic.ArraySortHelper`1[T].SwapIfGreater (T[] keys, System.Comparison`1[T] comparer, System.Int32 a, System.Int32 b) (at <e38a6d3ee47c43eb9b2e49c63fc0aa48>:0)
System.Collections.Generic.ArraySortHelper`1[T].IntroSort (T[] keys, System.Int32 lo, System.Int32 hi, System.Int32 depthLimit, System.Comparison`1[T] comparer) (at <e38a6d3ee47c43eb9b2e49c63fc0aa48>:0)
System.Collections.Generic.ArraySortHelper`1[T].IntrospectiveSort (T[] keys, System.Int32 left, System.Int32 length, System.Comparison`1[T] comparer) (at <e38a6d3ee47c43eb9b2e49c63fc0aa48>:0)
System.Collections.Generic.ArraySortHelper`1[T].Sort (T[] keys, System.Int32 index, System.Int32 length, System.Comparison`1[T] comparer) (at <e38a6d3ee47c43eb9b2e49c63fc0aa48>:0)
Rethrow as InvalidOperationException: Failed to compare two elements in the array.
System.Collections.Generic.ArraySortHelper`1[T].Sort (T[] keys, System.Int32 index, System.Int32 length, System.Comparison`1[T] comparer) (at <e38a6d3ee47c43eb9b2e49c63fc0aa48>:0)
System.Collections.Generic.List`1[T].Sort (System.Comparison`1[T] comparison) (at <e38a6d3ee47c43eb9b2e49c63fc0aa48>:0)
Mirage.NetworkProfiler.ModuleGUI.Messages.GroupSorter.Sort () (at Assets/Mirage.Profiler/Editor/Messages/GroupSorter.cs:25)
Mirage.NetworkProfiler.ModuleGUI.Messages.MessageView.Sort (Mirage.NetworkProfiler.ModuleGUI.UITable.ColumnInfo sortHeader, Mirage.NetworkProfiler.ModuleGUI.UITable.SortMode sortMode) (at Assets/Mirage.Profiler/Editor/Messages/MessageView.cs:110)
Mirage.NetworkProfiler.ModuleGUI.Messages.MessageViewController.SortFromSaveData () (at Assets/Mirage.Profiler/Editor/Messages/MessageViewController.cs:156)
Mirage.NetworkProfiler.ModuleGUI.Messages.MessageViewController.ReloadMessages () (at Assets/Mirage.Profiler/Editor/Messages/MessageViewController.cs:205)
Mirage.NetworkProfiler.ModuleGUI.Messages.MessageViewController.ReloadData () (at Assets/Mirage.Profiler/Editor/Messages/MessageViewController.cs:166)
Mirage.NetworkProfiler.ModuleGUI.Messages.MessageViewController.FrameIndexChanged (System.Int64 selectedFrameIndex) (at Assets/Mirage.Profiler/Editor/Messages/MessageViewController.cs:138)
UnityEditor.ProfilerWindow.InvokeSelectedFrameIndexChangedEventIfNecessary (System.Int32 newFrame) (at /Users/bokken/buildslave/unity/build/Modules/ProfilerEditor/ProfilerWindow/ProfilerWindow.cs:1821)
UnityEditor.ProfilerWindow.SetCurrentFrameDontPause (System.Int32 frame) (at /Users/bokken/buildslave/unity/build/Modules/ProfilerEditor/ProfilerWindow/ProfilerWindow.cs:1288)
UnityEditor.ProfilerWindow.SetCurrentFrame (System.Int32 frame) (at /Users/bokken/buildslave/unity/build/Modules/ProfilerEditor/ProfilerWindow/ProfilerWindow.cs:1299)
UnityEditor.ProfilerWindow.DoLegacyGUI_ToolbarAndCharts () (at /Users/bokken/buildslave/unity/build/Modules/ProfilerEditor/ProfilerWindow/ProfilerWindow.cs:1334)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/IMGUIContainer.cs:372)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/IMGUIContainer.cs:693)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/IMGUIContainer.cs:665)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/IMGUIContainer.cs:658)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUIRaw (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/IMGUIContainer.cs:618)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/IMGUIContainer.cs:607)
UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/IMGUIContainer.cs:535)
UnityEngine.UIElements.EventDispatchUtilities.PropagateEvent (UnityEngine.UIElements.EventBase evt) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/Events/IEventDispatchingStrategy.cs:113)
UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToRegularTarget (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/Events/MouseEventDispatchingStrategy.cs:35)
UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToTarget (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/Events/MouseEventDispatchingStrategy.cs:26)
UnityEngine.UIElements.MouseEventDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel iPanel) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/Events/MouseEventDispatchingStrategy.cs:19)
UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/EventDispatcher.cs:381)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/EventDispatcher.cs:344)
UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/EventDispatcher.cs:306)
UnityEngine.UIElements.EventDispatcher.OpenGate () (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/EventDispatcher.cs:270)
UnityEngine.UIElements.EventDispatcherGate.Dispose () (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/EventDispatcher.cs:75)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/EventDispatcher.cs:372)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/EventDispatcher.cs:222)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/Panel.cs:419)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/UIElementsUtility.cs:468)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/UIElementsUtility.cs:211)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/UIElementsUtility.cs:74)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/UIElementsUtility.cs:28)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)
github-actions bot pushed a commit that referenced this issue Sep 8, 2022
# [1.1.0](v1.0.4...v1.1.0) (2022-09-08)

### Bug Fixes

* fixes null ref when sort header is null ([d233036](d233036)), closes [#4](#4)
* fixing header being squashed if vertical scroll is full ([ad29f2e](ad29f2e))
* fixing null ref when group message is false ([004ba4e](004ba4e)), closes [#6](#6)
* stopping exception if rpc name does not contain dot ([#3](#3)) ([324a374](324a374))

### Features

* adding group message to save data ([3061381](3061381))
@github-actions
Copy link

github-actions bot commented Sep 8, 2022

🎉 This issue has been resolved in version 1.1.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

James-Frowen added a commit that referenced this issue Sep 8, 2022
github-actions bot pushed a commit that referenced this issue Sep 8, 2022
# [1.1.0-mirror.8](v1.1.0-mirror.7...v1.1.0-mirror.8) (2022-09-08)

### Bug Fixes

* fixes null ref when sort header is null ([9848b81](9848b81)), closes [#4](#4)
* fixing header being squashed if vertical scroll is full ([89e651e](89e651e))
* fixing null ref when group message is false ([6d3dfbf](6d3dfbf)), closes [#6](#6)
* stopping exception if rpc name does not contain dot ([#3](#3)) ([4f7a1bd](4f7a1bd))

### Features

* adding group message to save data ([12c3313](12c3313))
@github-actions
Copy link

github-actions bot commented Sep 8, 2022

🎉 This issue has been resolved in version 1.1.0-mirror.8 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant