Browser exit when load history items 74/48574/1
authorsungwon2han <sungwon2.han@samsung.com>
Wed, 23 Sep 2015 06:18:59 +0000 (15:18 +0900)
committersungwon2han <sungwon2.han@samsung.com>
Wed, 23 Sep 2015 06:18:59 +0000 (15:18 +0900)
[Issue#] NA
[Problem] Browser cannot get history info from browser-provider
[Cause] browser-provider issue
[Solution] add error check routine for browser-provider

Change-Id: I12368bc9394e8115c4debfa9b72d8aa5a9aa9f5c
Signed-off-by: sungwon2han <sungwon2.han@samsung.com>
services/HistoryService/HistoryService.cpp

index 1d93507..c60d669 100644 (file)
@@ -214,14 +214,18 @@ std::shared_ptr<HistoryItemVector> HistoryService::getMostVisitedHistoryItems()
         history->setTitle(std::string(history_info.title ? history_info.title : ""));
 
         //thumbail
-        std::shared_ptr<tizen_browser::tools::BrowserImage> hi = std::make_shared<tizen_browser::tools::BrowserImage>();
-        hi->imageType = tools::BrowserImage::ImageTypePNG;
-        hi->width = history_info.thumbnail_width;
-        hi->height = history_info.thumbnail_height;
-        hi->dataSize = history_info.thumbnail_length;
-        hi->imageData = (void*)malloc(history_info.thumbnail_length);
-        memcpy(hi->imageData, (void*)history_info.thumbnail, history_info.thumbnail_length);
-        history->setThumbnail(hi);
+        if (history_info.thumbnail_length != -1) {
+            std::shared_ptr<tizen_browser::tools::BrowserImage> hi = std::make_shared<tizen_browser::tools::BrowserImage>();
+            hi->imageType = tools::BrowserImage::ImageTypePNG;
+            hi->width = history_info.thumbnail_width;
+            hi->height = history_info.thumbnail_height;
+            hi->dataSize = history_info.thumbnail_length;
+            hi->imageData = (void*)malloc(history_info.thumbnail_length);
+            memcpy(hi->imageData, (void*)history_info.thumbnail, history_info.thumbnail_length);
+            history->setThumbnail(hi);
+        } else {
+            BROWSER_LOGD("history thumbnail lenght is -1");
+        }
 
         ret_history_list->push_back(history);
     }