From 473b02f718b0189057a429c3caa6f00b8601c76b Mon Sep 17 00:00:00 2001 From: Gary Sharp Date: Thu, 4 May 2023 15:27:46 +1000 Subject: [PATCH] bug fix: TryBinaryNumericEncode on small numbers --- .../Documents/DocumentUniqueIdentifierExtensions.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Disco.Services/Documents/DocumentUniqueIdentifierExtensions.cs b/Disco.Services/Documents/DocumentUniqueIdentifierExtensions.cs index 8adf7efb..312f922b 100644 --- a/Disco.Services/Documents/DocumentUniqueIdentifierExtensions.cs +++ b/Disco.Services/Documents/DocumentUniqueIdentifierExtensions.cs @@ -94,12 +94,11 @@ public static bool TryBinaryNumericEncode(string Data, out byte[] Result) Result = new byte[4]; int leadingZeros = 0; - for (leadingZeros = 0; leadingZeros <= 4; leadingZeros++) + for (int i = 0; i < Data.Length; i++) { if (Data[leadingZeros] != '0') - { break; - } + leadingZeros++; } if (leadingZeros <= 3)