[BUGFIX] Empty class selector crashes Update image 69/31169/2
authorFrancois Suter <francois@typo3.org>
Fri, 27 Jun 2014 13:40:35 +0000 (15:40 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Sat, 5 Jul 2014 14:03:28 +0000 (16:03 +0200)
Prevent the Update image dialog box to crash when trying to access
an empty class selector.

Resolves: #59938
Releases: 6.2, 6.3
Change-Id: Ida2c3dfb185064071fcdcda158f64e330562aa01
Reviewed-on: https://review.typo3.org/31169
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
typo3/sysext/rtehtmlarea/Classes/SelectImage.php

index 895c92a..9166c02 100644 (file)
@@ -474,7 +474,10 @@ class SelectImage extends \TYPO3\CMS\Recordlist\Browser\ElementBrowser {
                                                }
                                        }
                                        if (classesImage && document.imageData.iClass) {
-                                               var iClass = document.imageData.iClass.options[document.imageData.iClass.selectedIndex].value;
+                                               var iClass;
+                                               if (document.imageData.iClass.options.length > 0) {
+                                                       iClass = document.imageData.iClass.options[document.imageData.iClass.selectedIndex].value;
+                                               }
                                                if (iClass || (selectedImageRef.attributes["class"] && selectedImageRef.attributes["class"].value)) {
                                                        selectedImageRef.className = iClass;
                                                } else {