From 4ffc2f33d177deb03834e4e23db22cd207baeae4 Mon Sep 17 00:00:00 2001 From: LG Archer Date: Tue, 17 May 2016 10:41:51 +0100 Subject: [PATCH] Fix erroneous CallPriorityAttribute computation. Previous method of computing resulted in unexpected ordering when using Int32.MinValue or Int32.MaxValue as the Priority value. --- Server/Attributes.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Server/Attributes.cs b/Server/Attributes.cs index d27d4ce80..80196b3ee 100644 --- a/Server/Attributes.cs +++ b/Server/Attributes.cs @@ -86,7 +86,16 @@ namespace Server if ( y == null ) return -1; - return GetPriority( x ) - GetPriority( y ); + var xPriority = GetPriority( x ); + var yPriority = GetPriority( y ); + + if ( xPriority > yPriority ) + return 1; + + if ( xPriority < yPriority ) + return -1; + + return 0; } private int GetPriority( MethodInfo mi )