[vlc-devel] [PATCH 16/25] qt: fix possible invalid access in PlayerControlBar
Prince Gupta
guptaprince8832 at gmail.com
Thu Mar 11 09:16:24 UTC 2021
---
.../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();
--
2.25.1
More information about the vlc-devel
mailing list