From faeb2528ec1f4989f452262793e7881a25cd1147 Mon Sep 17 00:00:00 2001
From: Markus Klein <klein.t3@mfc-linz.at>
Date: Wed, 13 Nov 2013 02:19:43 +0100
Subject: [PATCH] [BUGFIX] Uncaught exception if editor has no file mount

If an editor has got no file mounts, an uncaught exception
is shown in the element browser.

Fix this by checking if there is a selected folder at all.

Resolves: #52969
Releases: 6.2
Change-Id: I5f9e8cc7994edd69f6db6ae1cc647ee31e4930c6
Reviewed-on: https://review.typo3.org/25357
Reviewed-by: Stefan Neufeind
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
---
 .../recordlist/Classes/Browser/ElementBrowser.php    | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/typo3/sysext/recordlist/Classes/Browser/ElementBrowser.php b/typo3/sysext/recordlist/Classes/Browser/ElementBrowser.php
index 711e63944900..ebab560c1211 100644
--- a/typo3/sysext/recordlist/Classes/Browser/ElementBrowser.php
+++ b/typo3/sysext/recordlist/Classes/Browser/ElementBrowser.php
@@ -1235,10 +1235,14 @@ class ElementBrowser {
 		$foldertree->ext_noTempRecyclerDirs = $this->mode == 'filedrag';
 		$tree = $foldertree->getBrowsableTree();
 		list(, , $specUid) = explode('_', $this->PM);
-		if ($this->mode == 'filedrag') {
-			$files = $this->TBE_dragNDrop($this->selectedFolder, $pArr[3]);
+		if ($this->selectedFolder) {
+			if ($this->mode == 'filedrag') {
+				$files = $this->TBE_dragNDrop($this->selectedFolder, $pArr[3]);
+			} else {
+				$files = $this->TBE_expandFolder($this->selectedFolder, $pArr[3], $noThumbs);
+			}
 		} else {
-			$files = $this->TBE_expandFolder($this->selectedFolder, $pArr[3], $noThumbs);
+			$files = '';
 		}
 		// Putting the parts together, side by side:
 		$content .= '
@@ -2249,4 +2253,4 @@ class ElementBrowser {
 		return $result;
 	}
 
-}
\ No newline at end of file
+}
-- 
GitLab