From d3967660588a02dd7965dda40b27a11117f0d137 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 16 Aug 2020 16:25:42 +0200 Subject: [PATCH] LibGUI: Require a model pointer for ModelIndex::is_valid() This was not an issue anywhere in practice, but let's make it part of the definition of a valid model index. --- Libraries/LibGUI/ModelIndex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/LibGUI/ModelIndex.h b/Libraries/LibGUI/ModelIndex.h index cdac89c85e..6c2c449f8f 100644 --- a/Libraries/LibGUI/ModelIndex.h +++ b/Libraries/LibGUI/ModelIndex.h @@ -38,7 +38,7 @@ class ModelIndex { public: ModelIndex() { } - bool is_valid() const { return m_row != -1 && m_column != -1; } + bool is_valid() const { return m_model && m_row != -1 && m_column != -1; } int row() const { return m_row; } int column() const { return m_column; }