Commit bc9b0be7 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

MediaPlayer: Don't wrap potentially uninitialized pointers

parent bd6ff48a
......@@ -1352,13 +1352,13 @@ public:
libvlc_title_descriptions_release( ts, nbTitles );
};
std::unique_ptr<libvlc_title_description_t*[], decltype(cleanupCb)> ptr(
titles, cleanupCb);
std::vector<TitleDescription> res;
if ( nbTitles < 1 )
return res;
std::unique_ptr<libvlc_title_description_t*[], decltype(cleanupCb)> ptr( titles, cleanupCb );
for ( int i = 0; i < nbTitles; ++i )
res.emplace_back( ptr[i] );
return res;
......@@ -1387,13 +1387,14 @@ public:
auto cleanupCb = [nbChapters](libvlc_chapter_description_t** cs) {
libvlc_chapter_descriptions_release( cs, nbChapters );
};
std::unique_ptr<libvlc_chapter_description_t*[], decltype(cleanupCb)> ptr( chapters, cleanupCb );
std::vector<ChapterDescription> res;
if ( nbChapters < 1 )
return res;
std::unique_ptr<libvlc_chapter_description_t*[], decltype(cleanupCb)> ptr( chapters, cleanupCb );
for ( int i = 0; i < nbChapters; ++i )
res.emplace_back( ptr[i] );
return res;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment