Fixed jira issue and fixed prevent issue
[apps/osp/MusicPlayer.git] / src / MpFolderListPresentationModel.cpp
index 7977ff3..66529a7 100644 (file)
@@ -115,6 +115,12 @@ FolderListPresentationModel::GetContentCount(int folderIndex)
        }
        else
        {
+               if (__pFolderPathList == null)
+               {
+                       AppLogDebug("EXIT");
+                       return INIT_VALUE;
+               }
+
                String* pStrPath = static_cast<String*>(__pFolderPathList->GetAt(folderIndex));
                ContentDirectory directory;
                r = directory.Construct(CONTENT_TYPE_AUDIO);
@@ -256,14 +262,6 @@ void
 FolderListPresentationModel::InitializeContentList(int folderIndex)
 {
        AppLogDebug("ENTER");
-       ContentDirectory contentDirectory;
-       result r = contentDirectory.Construct(CONTENT_TYPE_AUDIO);
-       if (IsFailed(r))
-       {
-               AppLogDebug("EXIT(%s)", GetErrorMessage(r));
-               return;
-       }
-
        if (__pContentList != null)
        {
                __pContentList->RemoveAll(true);
@@ -271,6 +269,14 @@ FolderListPresentationModel::InitializeContentList(int folderIndex)
                __pContentList = null;
        }
 
+       ContentDirectory contentDirectory;
+       result r = contentDirectory.Construct(CONTENT_TYPE_AUDIO);
+       if (IsFailed(r) || __pFolderPathList == null)
+       {
+               AppLogDebug("EXIT(%s)", GetErrorMessage(r));
+               return;
+       }
+
        String* pFolderPath = static_cast<String*>(__pFolderPathList->GetAt(folderIndex));
        if (pFolderPath != null)
        {
@@ -433,8 +439,6 @@ result
 FolderListPresentationModel::UpdateFolderPathList(void)
 {
        AppLogDebug("ENTER");
-       result r = E_SUCCESS;
-
        if (__pFolderPathList != null)
        {
                __pFolderPathList->RemoveAll(true);
@@ -442,11 +446,12 @@ FolderListPresentationModel::UpdateFolderPathList(void)
        }
 
        __pFolderPathList = ContentDirectoryPathList();
-       TryCatch(__pFolderPathList != null, r = E_FAILURE, "__pFolderPathList is null");
+       result r = GetLastResult();
+       if (__pFolderPathList == null)
+       {
+               r = E_FAILURE;
+       }
 
        AppLogDebug("EXIT");
        return r;
-
-CATCH:
-       return r;
 }
\ No newline at end of file