Explorar o código

* Fix for ConvUtils.CompatibleConversionTypes by Bart, resolves bug #39775

marcoonthegit %!s(int64=3) %!d(string=hai) anos
pai
achega
330b0b1157
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      packages/rtl-objpas/src/inc/convutil.inc

+ 3 - 1
packages/rtl-objpas/src/inc/convutil.inc

@@ -333,7 +333,9 @@ end;
 function CompatibleConversionTypes(const AFrom, ATo: TConvType): Boolean;
 
 begin
-  result:=ConvTypeToFamily(AFrom)=ConvTypeToFamily(ATo);
+ //ConvTypeToFamily returns TConvFamily(0) if the TConvType is not registerd, but 0 is a valid value for a TConvFamily
+  result:= (AFrom<length(TheUnits)) and (ATo<length(TheUnits)) and
+           (ConvTypeToFamily(AFrom)=ConvTypeToFamily(ATo));
 end;
 
 Function RegisterConversionFamily(Const S:String):TConvFamily;