summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAliaksandr Kalenik <kalenik.aliaksandr@gmail.com>2023-05-21 18:03:09 +0300
committerAndreas Kling <kling@serenityos.org>2023-05-22 06:05:19 +0200
commitb49e9d2eaba04148869ec41472d15c94973412d3 (patch)
tree8e15fbe4ca1ab9535e128e0ee0b9e2796512a6e0 /Userland
parent0c5d6c6c474a1a33faa3f1a72beda5a904e7a07f (diff)
downloadserenity-b49e9d2eaba04148869ec41472d15c94973412d3.zip
LibWeb: Check if line name is present in GridTrackSizeList::to_string()
Fixes crash in GridTrackSizeList::to_string() when line names are missing.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/CSS/GridTrackSize.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/GridTrackSize.cpp b/Userland/Libraries/LibWeb/CSS/GridTrackSize.cpp
index e8ed964d4c..0f8293077e 100644
--- a/Userland/Libraries/LibWeb/CSS/GridTrackSize.cpp
+++ b/Userland/Libraries/LibWeb/CSS/GridTrackSize.cpp
@@ -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());
}