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.
This commit is contained in:
Andreas Kling 2020-08-16 16:25:42 +02:00
parent a66e55ec64
commit d396766058
Notes: sideshowbarker 2024-07-19 03:32:56 +09:00

View file

@ -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; }