fixed: Properly fallback to root in case getdirectory fails in Update() + show error...
authorarnova <arnova@void.org>
Mon, 24 Dec 2012 22:16:15 +0000 (23:16 +0100)
committerarnova <arnova@void.org>
Thu, 27 Dec 2012 12:03:59 +0000 (13:03 +0100)
xbmc/windows/GUIWindowFileManager.cpp

index 7016131..1e23789 100644 (file)
@@ -471,7 +471,11 @@ bool CGUIWindowFileManager::Update(int iList, const CStdString &strDirectory)
   CFileItemList items;
   if (!GetDirectory(iList, m_Directory[iList]->GetPath(), items))
   {
-    m_Directory[iList]->SetPath(strOldDirectory);
+    if (strDirectory != strOldDirectory && GetDirectory(iList, strOldDirectory, items))
+      m_Directory[iList]->SetPath(strOldDirectory); // Fallback to old (previous) path)
+    else
+      Update(iList, ""); // Fallback to root
+
     return false;
   }
 
@@ -1196,10 +1200,9 @@ void CGUIWindowFileManager::ShowShareErrorMessage(CFileItem* pItem)
 
 void CGUIWindowFileManager::OnInitWindow()
 {
-  for (int i = 0; i < 2; i++)
-  {
-    Update(i, m_Directory[i]->GetPath());
-  }
+  bool bResult0 = Update(0, m_Directory[0]->GetPath());
+  bool bResult1 = Update(1, m_Directory[1]->GetPath());
+
   CGUIWindow::OnInitWindow();
 
   if (!bCheckShareConnectivity)
@@ -1209,6 +1212,15 @@ void CGUIWindowFileManager::OnInitWindow()
     ShowShareErrorMessage(&pItem); //show the error message after window is loaded!
     Update(0,""); // reset view to root
   }
+  else if (!bResult0)
+  {
+    ShowShareErrorMessage(m_Directory[0]); //show the error message after window is loaded!
+  }
+
+  if (!bResult1)
+  {
+    ShowShareErrorMessage(m_Directory[1]); //show the error message after window is loaded!
+  }
 }
 
 void CGUIWindowFileManager::SetInitialPath(const CStdString &path)