1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:28:12 +00:00

LibWeb: Check if line name is present in GridTrackSizeList::to_string()

Fixes crash in GridTrackSizeList::to_string() when line names are
missing.
This commit is contained in:
Aliaksandr Kalenik 2023-05-21 18:03:09 +03:00 committed by Andreas Kling
parent 0c5d6c6c47
commit b49e9d2eab

View file

@ -189,7 +189,7 @@ ErrorOr<String> GridTrackSizeList::to_string() const
};
for (size_t i = 0; i < m_track_list.size(); ++i) {
if (m_line_names[i].size() > 0) {
if (m_line_names.size() > 0 && m_line_names[i].size() > 0) {
print_line_names(i);
builder.append(" "sv);
}
@ -197,7 +197,7 @@ ErrorOr<String> GridTrackSizeList::to_string() const
if (i < m_track_list.size() - 1)
builder.append(" "sv);
}
if (m_line_names[m_track_list.size()].size() > 0) {
if (m_line_names.size() > 0 && m_line_names[m_track_list.size()].size() > 0) {
builder.append(" "sv);
print_line_names(m_track_list.size());
}