Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/AppKit/NSView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ public SortData (Func<NSView?, NSView?, NSComparisonResult> comparer)
#endif
static nint view_compare (IntPtr view1, IntPtr view2, IntPtr context)
{
var data = (SortData) GCHandle.FromIntPtr (context).Target;
var data = GCHandle.FromIntPtr (context).Target as SortData;
// should never happen, but we must be ready and not crash
if (data is null)
return (nint) (long) NSComparisonResult.Same;

try {
var a = Runtime.GetNSObject (view1) as NSView;
var b = Runtime.GetNSObject (view2) as NSView;
Expand Down