LCL: Don't access first element of ImageList if length=0. Issue #23834, patch from wp

git-svn-id: http://svn.freepascal.org/svn/lazarus/trunk@40192 4005530d-fff6-0310-9dd1-cebe43e6787f