From b61d19acccc11eaa85c67bd929597099f15b6e48 Mon Sep 17 00:00:00 2001 From: miku-666 <74728189+NessieHax@users.noreply.github.com> Date: Wed, 5 Feb 2025 19:19:36 +0100 Subject: [PATCH] PckNodeSorter - [Compare] Add safer type/null checking --- PCK-Studio/Internal/PckNodeSorter.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PCK-Studio/Internal/PckNodeSorter.cs b/PCK-Studio/Internal/PckNodeSorter.cs index af2390ad..934bc1be 100644 --- a/PCK-Studio/Internal/PckNodeSorter.cs +++ b/PCK-Studio/Internal/PckNodeSorter.cs @@ -21,9 +21,9 @@ namespace PckStudio.Internal public int Compare(object x, object y) { - TreeNode tx = x as TreeNode; - TreeNode ty = y as TreeNode; - return Compare(tx, ty); + if (x is TreeNode tx && y is TreeNode ty) + return Compare(tx, ty); + return 0; } public int Compare(TreeNode x, TreeNode y)