Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash if invalid row given. #114

wants to merge 4 commits into from


Copy link

commented Aug 25, 2014

Now the function checks if the row exists in the contact id list, and returns null if it doesn't instead of crashing.

@@ -700,7 +700,10 @@ bool SeasideFilteredModel::savePerson(SeasidePerson *person)

SeasidePerson *SeasideFilteredModel::personByRow(int row) const
return personFromItem(SeasideCache::itemById(m_contactIds->at(row)));
if(m_allContactIds->contains(row)) {

This comment has been minimized.

Copy link

SfietKonstantin Aug 25, 2014


This is not the correct behavior: imagine your m_allContactIds contains [0, 2], contains(2) returns true, while at(2) segfaults (trying to reach the 3rd item of the list). You should compare row to the size.

I would replace this by if (row >= 0 && row < m_allContactIds->size())

@vranki vranki closed this Aug 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.