vlc | branch: master | Prince Gupta <guptaprince8...@gmail.com> | Wed Feb 10 20:22:33 2021 +0530| [db2ccc02a6b93ee0eeb4be147b1cc1af7f5ed97f] | committer: Pierre Lamot
qt: fix possible invalid access in PlayerControlBar Signed-off-by: Pierre Lamot <pie...@videolabs.io> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=db2ccc02a6b93ee0eeb4be147b1cc1af7f5ed97f --- modules/gui/qt/player/playercontrolbarmodel.cpp | 39 ++++++++++++++----------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/modules/gui/qt/player/playercontrolbarmodel.cpp b/modules/gui/qt/player/playercontrolbarmodel.cpp index 28ed1ed1a6..6aa486cfa5 100644 --- a/modules/gui/qt/player/playercontrolbarmodel.cpp +++ b/modules/gui/qt/player/playercontrolbarmodel.cpp @@ -113,24 +113,29 @@ void PlayerControlBarModel::reloadModel() parseAndAdd(config.toString()); else { - QString alignment = configName.split("-").at(1); - if (configName.startsWith("MainPlayerToolbar")) + const auto configAndAlignment = configName.split("-"); + if (configAndAlignment.size() == 2) { - if (alignment == "left") - parseDefault(MAIN_TB_DEFAULT[default_align::ALIGN_LEFT]); - else if (alignment == "center") - parseDefault(MAIN_TB_DEFAULT[default_align::ALIGN_CENTER]); - else if (alignment == "right") - parseDefault(MAIN_TB_DEFAULT[default_align::ALIGN_RIGHT]); - } - else - { - if (alignment == "left") - parseDefault(MINI_TB_DEFAULT[default_align::ALIGN_LEFT]); - else if (alignment == "center") - parseDefault(MINI_TB_DEFAULT[default_align::ALIGN_CENTER]); - else if (alignment == "right") - parseDefault(MINI_TB_DEFAULT[default_align::ALIGN_RIGHT]); + const auto alignment = configAndAlignment[1]; + if (configAndAlignment[0] == QLatin1String("MainPlayerToolbar")) + { + if (alignment == "left") + parseDefault(MAIN_TB_DEFAULT[default_align::ALIGN_LEFT]); + else if (alignment == "center") + parseDefault(MAIN_TB_DEFAULT[default_align::ALIGN_CENTER]); + else if (alignment == "right") + parseDefault(MAIN_TB_DEFAULT[default_align::ALIGN_RIGHT]); + } + else + { + if (alignment == "left") + parseDefault(MINI_TB_DEFAULT[default_align::ALIGN_LEFT]); + else if (alignment == "center") + parseDefault(MINI_TB_DEFAULT[default_align::ALIGN_CENTER]); + else if (alignment == "right") + parseDefault(MINI_TB_DEFAULT[default_align::ALIGN_RIGHT]); + + } } } endResetModel(); _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits