From a41dedec645a0894d9173e5de0b502f727572f62 Mon Sep 17 00:00:00 2001
From: Jedidiah Barber <contact@jedbarber.id.au>
Date: Wed, 9 Apr 2025 23:54:13 +1200
Subject: Fixed RGB_Image size_t issue, RGB_Image/Bitmap preconditions

---
 body/fltk-images-rgb.adb | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

(limited to 'body/fltk-images-rgb.adb')

diff --git a/body/fltk-images-rgb.adb b/body/fltk-images-rgb.adb
index ce512cd..00fc1ed 100644
--- a/body/fltk-images-rgb.adb
+++ b/body/fltk-images-rgb.adb
@@ -159,7 +159,9 @@ package body FLTK.Images.RGB is
         begin
             return This : RGB_Image do
                 This.Void_Ptr := new_fl_rgb_image
-                   (Storage.To_Integer (Data (Data'First)'Address),
+                   ((if Data'Length > 0
+                     then Storage.To_Integer (Data (Data'First)'Address)
+                     else Null_Pointer),
                     Interfaces.C.int (Width),
                     Interfaces.C.int (Height),
                     Interfaces.C.int (Depth),
@@ -192,14 +194,14 @@ package body FLTK.Images.RGB is
     --  Static Settings  --
 
     function Get_Max_Size
-        return Natural is
+        return Size_Type is
     begin
-        return Natural (fl_rgb_image_get_max_size);
+        return Size_Type (fl_rgb_image_get_max_size);
     end Get_Max_Size;
 
 
     procedure Set_Max_Size
-           (Value : in Natural) is
+           (Value : in Size_Type) is
     begin
         fl_rgb_image_set_max_size (Interfaces.C.size_t (Value));
     end Set_Max_Size;
-- 
cgit