lottieplayer: add exceptions
authorHermet Park <hermetpark@gmail.com>
Fri, 13 Jul 2018 12:13:03 +0000 (21:13 +0900)
committersubhransu mohanty <sub.mohanty@samsung.com>
Mon, 16 Jul 2018 03:07:42 +0000 (12:07 +0900)
Change-Id: I03de73851867e78de3231131ac92154ca39c3dec

src/lottie/lottieplayer.cpp

index 52a6158..e4f02b0 100644 (file)
@@ -27,19 +27,33 @@ public:
 
 void LOTPlayerPrivate::setSize(const VSize &sz)
 {
+    if (!mCompItem.get()) {
+        vWarning << "Set file first!";
+        return;
+    }
+
     mCompItem->resize(sz);
 }
 
 void LOTPlayerPrivate::size(int &w, int &h) const
 {
+    if (!mCompItem.get()) {
+        w = 0;
+        h = 0;
+        return;
+    }
+
     VSize size = mCompItem->size();
     w = size.width();
     h = size.height();
 }
 
-
 const std::vector<LOTNode *>& LOTPlayerPrivate::renderList() const
 {
+    if (!mCompItem.get()) {
+        //FIXME: Reference is not good...
+    }
+
     return mCompItem->renderList();
 }
 
@@ -72,7 +86,6 @@ bool LOTPlayerPrivate::render(float pos, const LOTBuffer &buffer)
     }
 }
 
-
 LOTPlayerPrivate::LOTPlayerPrivate()
 {
 
@@ -90,7 +103,6 @@ LOTPlayerPrivate::setFilePath(std::string path)
    return false;
 }
 
-
 LOTPlayer::LOTPlayer():d(new LOTPlayerPrivate())
 {