From c4c41403c4ec6a2c19f197305a98efa717c79e9d Mon Sep 17 00:00:00 2001
From: Graeme Geldenhuys <graeme@mastermaths.co.za>
Date: Thu, 28 Oct 2010 10:51:56 +0200
Subject: extra error checking in mimelist DND operation

---
 src/corelib/x11/fpg_x11.pas | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/corelib/x11/fpg_x11.pas b/src/corelib/x11/fpg_x11.pas
index 9be3276f..f56a4851 100644
--- a/src/corelib/x11/fpg_x11.pas
+++ b/src/corelib/x11/fpg_x11.pas
@@ -1114,9 +1114,15 @@ begin
           lMimeList := TStringList.Create;
           for i := 0 to FDNDTypeList.Count-1 do
             lMimeList.Add(TDNDSrcType(FDNDTypeList[i]).Name);
+
           { Use the first mime-type as the default option presented. The mime-list
             should always be from most specific to least specific. }
-          lMimeChoice := lMimeList[0];
+          if lMimeList.Count > 0 then
+            lMimeChoice := lMimeList[0]
+          else
+            {$NOTE We need to replace this message with a resouce string }
+            raise Exception.Create('fpGUI/X11: no mime types available for DND operation');
+
           { TODO: We need to populate the Source parameter. }
           wg.OnDragEnter(self, nil, lMimeList, lMimeChoice, lDropAction, lAccept);
           lMimeList.Free;
-- 
cgit v1.2.3-70-g09d2