Fix svace issues on WebView
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / web-view / web-view-impl.cpp
index 86b39c2..bf85d8d 100755 (executable)
@@ -130,7 +130,8 @@ WebView::WebView(const std::string& locale, const std::string& timezoneId)
   mWebViewArea(0, 0, mWebViewSize.width, mWebViewSize.height),
   mVideoHoleEnabled(true),
   mMouseEventsEnabled(true),
-  mKeyEventsEnabled(true)
+  mKeyEventsEnabled(true),
+  mScreenshotCapturedCallback(nullptr)
 {
   mWebEngine = Dali::WebEngine::New();
 
@@ -154,7 +155,8 @@ WebView::WebView(uint32_t argc, char** argv)
   mWebViewArea(0, 0, mWebViewSize.width, mWebViewSize.height),
   mVideoHoleEnabled(true),
   mMouseEventsEnabled(true),
-  mKeyEventsEnabled(true)
+  mKeyEventsEnabled(true),
+  mScreenshotCapturedCallback(nullptr)
 {
   mWebEngine = Dali::WebEngine::New();
 
@@ -268,14 +270,15 @@ Dali::Toolkit::WebBackForwardList* WebView::GetBackForwardList() const
   return mWebBackForwardList.get();
 }
 
-Dali::Toolkit::ImageView& WebView::GetFavicon()
+Dali::Toolkit::ImageView WebView::GetFavicon() const
 {
+  Dali::Toolkit::ImageView faviconView;
   if(mWebEngine)
   {
     Dali::PixelData pixelData = mWebEngine.GetFavicon();
-    mFaviconView              = CreateImageView(pixelData);
+    faviconView               = CreateImageView(pixelData);
   }
-  return mFaviconView;
+  return faviconView;
 }
 
 void WebView::LoadUrl(const std::string& url)
@@ -706,8 +709,13 @@ void WebView::EnableBlendMode(bool blendEnabled)
   }
 }
 
-Dali::Toolkit::ImageView WebView::CreateImageView(Dali::PixelData pixel)
+Dali::Toolkit::ImageView WebView::CreateImageView(Dali::PixelData pixel) const
 {
+  if(!pixel)
+  {
+    return Dali::Toolkit::ImageView();
+  }
+
   std::string              url       = Dali::Toolkit::Image::GenerateUrl(pixel);
   Dali::Toolkit::ImageView imageView = Dali::Toolkit::ImageView::New(url);
   imageView.SetProperty(Dali::Actor::Property::SIZE, Vector2(pixel.GetWidth(), pixel.GetHeight()));