lottieplayer: add exceptions

Change-Id: I03de73851867e78de3231131ac92154ca39c3dec
This commit is contained in:
Hermet Park 2018-07-13 21:13:03 +09:00 committed by subhransu mohanty
parent 79aa9abfa5
commit cb52a637aa

View File

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