From 1f21b797cff584cfaa18b27ca88b325c7e8b01ef Mon Sep 17 00:00:00 2001
From: biwa <6475593+biwa@users.noreply.github.com>
Date: Sat, 14 Oct 2023 15:16:29 +0200
Subject: [PATCH] UDMF type handler: fixed a problem where default values
 provided as integers for floating point fields failed to convert properly

---
 Source/Core/Types/FloatHandler.cs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Source/Core/Types/FloatHandler.cs b/Source/Core/Types/FloatHandler.cs
index ded0f6842..f622e43f4 100755
--- a/Source/Core/Types/FloatHandler.cs
+++ b/Source/Core/Types/FloatHandler.cs
@@ -52,7 +52,8 @@ namespace CodeImp.DoomBuilder.Types
 
 		public override void SetupField(TypeHandlerAttribute attr, UniversalFieldInfo fieldinfo)
 		{
-			defaultvalue = (fieldinfo == null || fieldinfo.Default == null) ? 0.0 : (double)fieldinfo.Default;
+			// The default value might be given as int instead as a floating point number, so try to convert it
+			defaultvalue = (fieldinfo == null || fieldinfo.Default == null) ? 0.0 : Convert.ToDouble(fieldinfo.Default);
 			base.SetupField(attr, fieldinfo);
 		}
 
-- 
GitLab