mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-13 19:44:28 +00:00
examples: preventing undef behavior
Calling get() on a unique pointer after it has been moved is the undefined behavior.
This commit is contained in:
parent
d60a7bec7e
commit
9102f66948
2 changed files with 6 additions and 4 deletions
|
@ -40,8 +40,9 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
|||
cout << "The PNG file is not loaded correctly. Did you enable PNG Loader?" << endl;
|
||||
return;
|
||||
}
|
||||
if (canvas->push(move(picture)) == tvg::Result::Success) {
|
||||
pPicture = picture.get();
|
||||
pPicture = picture.get();
|
||||
if (canvas->push(move(picture)) != tvg::Result::Success) {
|
||||
pPicture = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,8 +40,9 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
|||
cout << "The PNG file is not loaded correctly. Did you enable PNG Loader?" << endl;
|
||||
return;
|
||||
}
|
||||
if (canvas->push(move(picture)) == tvg::Result::Success) {
|
||||
pPicture = picture.get();
|
||||
pPicture = picture.get();
|
||||
if (canvas->push(move(picture)) != tvg::Result::Success) {
|
||||
pPicture = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue