[vlc-commits] [Git][videolan/vlc][master] skins2: parser: check parent list before access
Steve Lhomme (@robUx4)
gitlab at videolan.org
Tue Aug 18 05:05:52 UTC 2026
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
fbe4f7f2 by François Cartegnie at 2026-08-18T04:54:23+00:00
skins2: parser: check parent list before access
refs #29930
- - - - -
1 changed file:
- modules/gui/skins2/parser/skin_parser.cpp
Changes:
=====================================
modules/gui/skins2/parser/skin_parser.cpp
=====================================
@@ -202,7 +202,7 @@ void SkinParser::handleBeginElement( const std::string &rName, AttrList_t &attr
m_pData->m_listPopupMenu.push_back( popup );
}
- else if( rName == "MenuItem" )
+ else if( rName == "MenuItem" && !m_popupPosList.empty() )
{
RequireAttr( attr, rName, "label" );
DefaultAttr( attr, "action", "none" );
@@ -214,7 +214,7 @@ void SkinParser::handleBeginElement( const std::string &rName, AttrList_t &attr
m_popupPosList.back()++;
}
- else if( rName == "MenuSeparator" )
+ else if( rName == "MenuSeparator" && !m_popupPosList.empty() )
{
const BuilderData::MenuSeparator sep( m_popupPosList.back(),
m_curPopupId );
@@ -222,7 +222,7 @@ void SkinParser::handleBeginElement( const std::string &rName, AttrList_t &attr
m_popupPosList.back()++;
}
- else if( rName == "Button" )
+ else if( rName == "Button" && !m_panelStack.empty() )
{
RequireAttr( attr, rName, "up" );
DefaultAttr( attr, "id", "none" );
@@ -255,7 +255,7 @@ void SkinParser::handleBeginElement( const std::string &rName, AttrList_t &attr
m_pData->m_listButton.push_back( button );
}
- else if( rName == "Checkbox" )
+ else if( rName == "Checkbox" && !m_panelStack.empty() )
{
RequireAttr( attr, rName, "up1" );
RequireAttr( attr, rName, "up2" );
@@ -318,7 +318,7 @@ void SkinParser::handleBeginElement( const std::string &rName, AttrList_t &attr
m_yOffsetList.push_back( atoi( attr["y"] ) );
}
- else if( rName == "Image" )
+ else if( rName == "Image" && !m_panelStack.empty() )
{
RequireAttr( attr, rName, "image" );
DefaultAttr( attr, "id", "none" );
@@ -385,7 +385,7 @@ void SkinParser::handleBeginElement( const std::string &rName, AttrList_t &attr
m_curLayer = 0;
}
- else if( rName == "Panel" )
+ else if( rName == "Panel" && !m_panelStack.empty() )
{
DefaultAttr( attr, "x", "0" );
DefaultAttr( attr, "y", "0" );
@@ -426,7 +426,7 @@ void SkinParser::handleBeginElement( const std::string &rName, AttrList_t &attr
m_panelStack.push_back( std::move(panelId) );
}
- else if( rName == "Playlist" )
+ else if( rName == "Playlist" && !m_panelStack.empty() )
{
RequireAttr( attr, rName, "id" );
RequireAttr( attr, rName, "font" );
@@ -487,7 +487,7 @@ void SkinParser::handleBeginElement( const std::string &rName, AttrList_t &attr
m_curLayer++;
m_pData->m_listTree.push_back( treeData );
}
- else if( rName == "Playtree" )
+ else if( rName == "Playtree" && !m_panelStack.empty() )
{
RequireAttr( attr, rName, "id" );
RequireAttr( attr, rName, "font" );
@@ -547,7 +547,7 @@ void SkinParser::handleBeginElement( const std::string &rName, AttrList_t &attr
m_pData->m_listTree.push_back( treeData );
}
- else if( rName == "RadialSlider" )
+ else if( rName == "RadialSlider" && !m_panelStack.empty() )
{
RequireAttr( attr, rName, "sequence" );
RequireAttr( attr, rName, "nbimages" );
@@ -583,7 +583,7 @@ void SkinParser::handleBeginElement( const std::string &rName, AttrList_t &attr
m_pData->m_listRadialSlider.push_back( radial );
}
- else if( rName == "Slider" )
+ else if( rName == "Slider" && !m_panelStack.empty() )
{
RequireAttr( attr, rName, "up" );
RequireAttr( attr, rName, "points" );
@@ -630,7 +630,7 @@ void SkinParser::handleBeginElement( const std::string &rName, AttrList_t &attr
m_pData->m_listSlider.push_back( slider );
}
- else if( rName == "SliderBackground" )
+ else if( rName == "SliderBackground" && !m_pData->m_listSlider.empty() )
{
RequireAttr( attr, rName, "image" );
DefaultAttr( attr, "nbhoriz", "1" );
@@ -648,7 +648,7 @@ void SkinParser::handleBeginElement( const std::string &rName, AttrList_t &attr
slider.m_padVert = atoi( attr["padvert"] );
}
- else if( rName == "Text" )
+ else if( rName == "Text" && !m_panelStack.empty() )
{
RequireAttr( attr, rName, "font" );
DefaultAttr( attr, "id", "none" );
@@ -723,7 +723,7 @@ void SkinParser::handleBeginElement( const std::string &rName, AttrList_t &attr
attr["author"] );
}
- else if( rName == "Video" )
+ else if( rName == "Video" && !m_panelStack.empty() )
{
DefaultAttr( attr, "id", "none" );
DefaultAttr( attr, "visible", "true" );
@@ -802,7 +802,7 @@ void SkinParser::handleBeginElement( const std::string &rName, AttrList_t &attr
void SkinParser::handleEndElement( const std::string &rName )
{
- if( rName == "Group" )
+ if( rName == "Group" && !m_xOffsetList.empty() && !m_yOffsetList.empty() )
{
m_xOffset -= m_xOffsetList.back();
m_yOffset -= m_yOffsetList.back();
@@ -813,12 +813,12 @@ void SkinParser::handleEndElement( const std::string &rName )
{
m_curTreeId = "";
}
- else if( rName == "Popup" )
+ else if( rName == "Popup" && !m_popupPosList.empty() )
{
m_curPopupId = "";
m_popupPosList.pop_back();
}
- else if( rName == "Panel" )
+ else if( rName == "Panel" && !m_panelStack.empty() )
{
m_panelStack.pop_back();
}
@@ -915,7 +915,7 @@ void SkinParser::getRefDimensions( int &rWidth, int &rHeight, bool toScreen ) co
return;
}
- std::string panelId = m_panelStack.back();
+ std::string panelId = m_panelStack.empty() ? "none" : m_panelStack.back();
if( panelId != "none" )
{
std::list<BuilderData::Panel>::const_iterator it;
@@ -930,7 +930,7 @@ void SkinParser::getRefDimensions( int &rWidth, int &rHeight, bool toScreen ) co
}
}
}
- else
+ else if( !m_pData->m_listLayout.empty() )
{
const BuilderData::Layout layout = m_pData->m_listLayout.back();
rWidth = layout.m_width;
@@ -1042,6 +1042,9 @@ void SkinParser::convertPosition( const std::string &position, const std::string
void SkinParser::updateWindowPos( int width, int height )
{
+ if( m_pData->m_listWindow.empty() )
+ return;
+
BuilderData::Window win = m_pData->m_listWindow.back();
m_pData->m_listWindow.pop_back();
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/fbe4f7f2870846e246e58ac4532340ff6129c268
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/fbe4f7f2870846e246e58ac4532340ff6129c268
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the vlc-commits
mailing list