{"action":"created","comment":{"url":"https://api.github.com/repos/Subsurface-divelog/subsurface/pulls/comments/214401566","pull_request_review_id":151457753,"id":214401566,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNDQwMTU2Ng==","diff_hunk":"@@ -412,6 +412,8 @@ bool MultiFilterSortModel::filterAcceptsRow(int source_row, const QModelIndex &s\n {\n \tQModelIndex index0 = sourceModel()->index(source_row, 0, source_parent);\n \tQVariant diveVariant = sourceModel()->data(index0, DiveTripModel::DIVE_ROLE);\n+\tif (!diveVariant.isValid())\n+\t\treturn true;","path":"qt-models/filtermodels.cpp","position":5,"original_position":5,"commit_id":"8e05a24f1b223507c87d4454399cbd3e08585090","original_commit_id":"8e05a24f1b223507c87d4454399cbd3e08585090","user":{"login":"dirkhh","id":237471,"node_id":"MDQ6VXNlcjIzNzQ3MQ==","avatar_url":"https://avatars1.githubusercontent.com/u/237471?v=4","gravatar_id":"","url":"https://api.github.com/users/dirkhh","html_url":"https://github.com/dirkhh","followers_url":"https://api.github.com/users/dirkhh/followers","following_url":"https://api.github.com/users/dirkhh/following{/other_user}","gists_url":"https://api.github.com/users/dirkhh/gists{/gist_id}","starred_url":"https://api.github.com/users/dirkhh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dirkhh/subscriptions","organizations_url":"https://api.github.com/users/dirkhh/orgs","repos_url":"https://api.github.com/users/dirkhh/repos","events_url":"https://api.github.com/users/dirkhh/events{/privacy}","received_events_url":"https://api.github.com/users/dirkhh/received_events","type":"User","site_admin":false},"body":"Well ... The QVariant would be valid for a trip.\r\nMy understanding is that you should never do `.value()` on an invalid QVariant.\r\nBut it's of course possible that I'm missing something. In my limited testing this did seem to do the right thing...\r\n","created_at":"2018-08-31T16:02:54Z","updated_at":"2018-08-31T16:02:55Z","html_url":"https://github.com/Subsurface-divelog/subsurface/pull/1616#discussion_r214401566","pull_request_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/pulls/1616","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/Subsurface-divelog/subsurface/pulls/comments/214401566"},"html":{"href":"https://github.com/Subsurface-divelog/subsurface/pull/1616#discussion_r214401566"},"pull_request":{"href":"https://api.github.com/repos/Subsurface-divelog/subsurface/pulls/1616"}},"in_reply_to_id":214392381},"pull_request":{"url":"https://api.github.com/repos/Subsurface-divelog/subsurface/pulls/1616","id":212406078,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEyNDA2MDc4","html_url":"https://github.com/Subsurface-divelog/subsurface/pull/1616","diff_url":"https://github.com/Subsurface-divelog/subsurface/pull/1616.diff","patch_url":"https://github.com/Subsurface-divelog/subsurface/pull/1616.patch","issue_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/issues/1616","number":1616,"state":"open","locked":false,"title":"Desktop: prevent crash when deleting all dives in trip","user":{"login":"dirkhh","id":237471,"node_id":"MDQ6VXNlcjIzNzQ3MQ==","avatar_url":"https://avatars1.githubusercontent.com/u/237471?v=4","gravatar_id":"","url":"https://api.github.com/users/dirkhh","html_url":"https://github.com/dirkhh","followers_url":"https://api.github.com/users/dirkhh/followers","following_url":"https://api.github.com/users/dirkhh/following{/other_user}","gists_url":"https://api.github.com/users/dirkhh/gists{/gist_id}","starred_url":"https://api.github.com/users/dirkhh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dirkhh/subscriptions","organizations_url":"https://api.github.com/users/dirkhh/orgs","repos_url":"https://api.github.com/users/dirkhh/repos","events_url":"https://api.github.com/users/dirkhh/events{/privacy}","received_events_url":"https://api.github.com/users/dirkhh/received_events","type":"User","site_admin":false},"body":"Instead of trying to dereference a dive pointer extracted from an\r\ninvalid QVariant, we should just accept that row and let the work\r\ncontinue (which will eventually remove the trip which caused us to\r\neven call the filter).\r\n\r\nSigned-off-by: Dirk Hohndel <dirk@hohndel.org>\r\n\r\n<!-- Lines like this one are comments and will not be shown in the final output. -->\r\n<!-- Make sure that you have read the \"Contributing\" section of the README and also the notes in CodingStyle. -->\r\n<!-- If you are a collaborator, please add labels and assign other collaborators for a review. -->\r\n\r\n### Describe the pull request:\r\n<!-- Replace [ ] with [x] to select options. -->\r\n- [x] Bug fix\r\n- [ ] Functional change\r\n- [ ] New feature\r\n- [ ] Code cleanup\r\n- [ ] Build system change\r\n- [ ] Documentation change\r\n- [ ] Language translation\r\n\r\n### Pull request long description:\r\n<!-- Describe your pull request in detail. -->\r\nWhen playing around with something completely unrelated, I noticed a way to crash Subsurface. We were dereferencing an invalid QVariant.\r\n\r\n### Changes made:\r\n<!-- Enumerate the changes with 1), 2), 3) etc. -->\r\n<!-- Ensure the test cases are updated if needed. -->\r\nsimply bail if the QVariant is invalid - in my case this happened while we were removing the last dive in a trip and then the trip\r\n\r\n### Related issues:\r\n<!-- Reference issues with #<issue-num>. -->\r\n<!-- Write \"Fixes #<issue-num\" to notify Github that this PR fixes an issue. -->\r\nThe stack trace when crashing looks suspiciously like the one in #1607 \r\n\r\n### Release note:\r\n<!-- Describe if this change needs a release note present in CHANGELOG.md. -->\r\n<!-- Also, please make sure to add the release note on top of the file CHANGELOG.md. -->\r\nNot sure if this is big enough to deserve a mention. \"Desktop: fix potential crash when deleting dive trips\"\r\n\r\n### Documentation change:\r\n<!-- If this PR makes changes to user functionality, then the documentation has to be updated too. -->\r\n<!-- Please, briefly outline here what has changed in terms of the user experience (UX). -->\r\n<!-- If UX changes have been made, a maintainer should apply the 'needs-documentation-change' label. -->\r\nnone\r\n\r\n### Mentions:\r\n<!-- Mention users that you want to review your pull request with @<user-name>. Leave empty if not sure. -->\r\n@p-neves @bstoeger ","created_at":"2018-08-31T14:44:42Z","updated_at":"2018-08-31T16:02:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dbfac5b968f2273a5c7dfa54a0bb7eae90f11a90","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/pulls/1616/commits","review_comments_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/pulls/1616/comments","review_comment_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/issues/1616/comments","statuses_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/statuses/8e05a24f1b223507c87d4454399cbd3e08585090","head":{"label":"Subsurface-divelog:filterCrashFix","ref":"filterCrashFix","sha":"8e05a24f1b223507c87d4454399cbd3e08585090","user":{"login":"Subsurface-divelog","id":24829199,"node_id":"MDQ6VXNlcjI0ODI5MTk5","avatar_url":"https://avatars1.githubusercontent.com/u/24829199?v=4","gravatar_id":"","url":"https://api.github.com/users/Subsurface-divelog","html_url":"https://github.com/Subsurface-divelog","followers_url":"https://api.github.com/users/Subsurface-divelog/followers","following_url":"https://api.github.com/users/Subsurface-divelog/following{/other_user}","gists_url":"https://api.github.com/users/Subsurface-divelog/gists{/gist_id}","starred_url":"https://api.github.com/users/Subsurface-divelog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Subsurface-divelog/subscriptions","organizations_url":"https://api.github.com/users/Subsurface-divelog/orgs","repos_url":"https://api.github.com/users/Subsurface-divelog/repos","events_url":"https://api.github.com/users/Subsurface-divelog/events{/privacy}","received_events_url":"https://api.github.com/users/Subsurface-divelog/received_events","type":"User","site_admin":false},"repo":{"id":2319498,"node_id":"MDEwOlJlcG9zaXRvcnkyMzE5NDk4","name":"subsurface","full_name":"Subsurface-divelog/subsurface","owner":{"login":"Subsurface-divelog","id":24829199,"node_id":"MDQ6VXNlcjI0ODI5MTk5","avatar_url":"https://avatars1.githubusercontent.com/u/24829199?v=4","gravatar_id":"","url":"https://api.github.com/users/Subsurface-divelog","html_url":"https://github.com/Subsurface-divelog","followers_url":"https://api.github.com/users/Subsurface-divelog/followers","following_url":"https://api.github.com/users/Subsurface-divelog/following{/other_user}","gists_url":"https://api.github.com/users/Subsurface-divelog/gists{/gist_id}","starred_url":"https://api.github.com/users/Subsurface-divelog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Subsurface-divelog/subscriptions","organizations_url":"https://api.github.com/users/Subsurface-divelog/orgs","repos_url":"https://api.github.com/users/Subsurface-divelog/repos","events_url":"https://api.github.com/users/Subsurface-divelog/events{/privacy}","received_events_url":"https://api.github.com/users/Subsurface-divelog/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Subsurface-divelog/subsurface","description":"This is the official upstream of the Subsurface divelog program","fork":false,"url":"https://api.github.com/repos/Subsurface-divelog/subsurface","forks_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/forks","keys_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/teams","hooks_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/hooks","issue_events_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/issues/events{/number}","events_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/events","assignees_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/assignees{/user}","branches_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/branches{/branch}","tags_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/tags","blobs_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/git/refs{/sha}","trees_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/statuses/{sha}","languages_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/languages","stargazers_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/stargazers","contributors_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/contributors","subscribers_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/subscribers","subscription_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/subscription","commits_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/commits{/sha}","git_commits_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/git/commits{/sha}","comments_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/comments{/number}","issue_comment_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/issues/comments{/number}","contents_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/contents/{+path}","compare_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/merges","archive_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/downloads","issues_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/issues{/number}","pulls_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/pulls{/number}","milestones_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/milestones{/number}","notifications_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/labels{/name}","releases_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/releases{/id}","deployments_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/deployments","created_at":"2011-09-03T15:27:51Z","updated_at":"2018-08-31T14:48:29Z","pushed_at":"2018-08-31T15:39:36Z","git_url":"git://github.com/Subsurface-divelog/subsurface.git","ssh_url":"git@github.com:Subsurface-divelog/subsurface.git","clone_url":"https://github.com/Subsurface-divelog/subsurface.git","svn_url":"https://github.com/Subsurface-divelog/subsurface","homepage":"https://subsurface-divelog.org","size":96262,"stargazers_count":1421,"watchers_count":1421,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":357,"mirror_url":null,"archived":false,"open_issues_count":92,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":357,"open_issues":92,"watchers":1421,"default_branch":"master"}},"base":{"label":"Subsurface-divelog:master","ref":"master","sha":"554a7aaba4ad1a65a68a7d3e6f8aeece548351b9","user":{"login":"Subsurface-divelog","id":24829199,"node_id":"MDQ6VXNlcjI0ODI5MTk5","avatar_url":"https://avatars1.githubusercontent.com/u/24829199?v=4","gravatar_id":"","url":"https://api.github.com/users/Subsurface-divelog","html_url":"https://github.com/Subsurface-divelog","followers_url":"https://api.github.com/users/Subsurface-divelog/followers","following_url":"https://api.github.com/users/Subsurface-divelog/following{/other_user}","gists_url":"https://api.github.com/users/Subsurface-divelog/gists{/gist_id}","starred_url":"https://api.github.com/users/Subsurface-divelog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Subsurface-divelog/subscriptions","organizations_url":"https://api.github.com/users/Subsurface-divelog/orgs","repos_url":"https://api.github.com/users/Subsurface-divelog/repos","events_url":"https://api.github.com/users/Subsurface-divelog/events{/privacy}","received_events_url":"https://api.github.com/users/Subsurface-divelog/received_events","type":"User","site_admin":false},"repo":{"id":2319498,"node_id":"MDEwOlJlcG9zaXRvcnkyMzE5NDk4","name":"subsurface","full_name":"Subsurface-divelog/subsurface","owner":{"login":"Subsurface-divelog","id":24829199,"node_id":"MDQ6VXNlcjI0ODI5MTk5","avatar_url":"https://avatars1.githubusercontent.com/u/24829199?v=4","gravatar_id":"","url":"https://api.github.com/users/Subsurface-divelog","html_url":"https://github.com/Subsurface-divelog","followers_url":"https://api.github.com/users/Subsurface-divelog/followers","following_url":"https://api.github.com/users/Subsurface-divelog/following{/other_user}","gists_url":"https://api.github.com/users/Subsurface-divelog/gists{/gist_id}","starred_url":"https://api.github.com/users/Subsurface-divelog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Subsurface-divelog/subscriptions","organizations_url":"https://api.github.com/users/Subsurface-divelog/orgs","repos_url":"https://api.github.com/users/Subsurface-divelog/repos","events_url":"https://api.github.com/users/Subsurface-divelog/events{/privacy}","received_events_url":"https://api.github.com/users/Subsurface-divelog/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Subsurface-divelog/subsurface","description":"This is the official upstream of the Subsurface divelog program","fork":false,"url":"https://api.github.com/repos/Subsurface-divelog/subsurface","forks_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/forks","keys_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/teams","hooks_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/hooks","issue_events_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/issues/events{/number}","events_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/events","assignees_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/assignees{/user}","branches_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/branches{/branch}","tags_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/tags","blobs_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/git/refs{/sha}","trees_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/statuses/{sha}","languages_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/languages","stargazers_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/stargazers","contributors_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/contributors","subscribers_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/subscribers","subscription_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/subscription","commits_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/commits{/sha}","git_commits_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/git/commits{/sha}","comments_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/comments{/number}","issue_comment_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/issues/comments{/number}","contents_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/contents/{+path}","compare_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/merges","archive_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/downloads","issues_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/issues{/number}","pulls_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/pulls{/number}","milestones_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/milestones{/number}","notifications_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/labels{/name}","releases_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/releases{/id}","deployments_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/deployments","created_at":"2011-09-03T15:27:51Z","updated_at":"2018-08-31T14:48:29Z","pushed_at":"2018-08-31T15:39:36Z","git_url":"git://github.com/Subsurface-divelog/subsurface.git","ssh_url":"git@github.com:Subsurface-divelog/subsurface.git","clone_url":"https://github.com/Subsurface-divelog/subsurface.git","svn_url":"https://github.com/Subsurface-divelog/subsurface","homepage":"https://subsurface-divelog.org","size":96262,"stargazers_count":1421,"watchers_count":1421,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":357,"mirror_url":null,"archived":false,"open_issues_count":92,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":357,"open_issues":92,"watchers":1421,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Subsurface-divelog/subsurface/pulls/1616"},"html":{"href":"https://github.com/Subsurface-divelog/subsurface/pull/1616"},"issue":{"href":"https://api.github.com/repos/Subsurface-divelog/subsurface/issues/1616"},"comments":{"href":"https://api.github.com/repos/Subsurface-divelog/subsurface/issues/1616/comments"},"review_comments":{"href":"https://api.github.com/repos/Subsurface-divelog/subsurface/pulls/1616/comments"},"review_comment":{"href":"https://api.github.com/repos/Subsurface-divelog/subsurface/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Subsurface-divelog/subsurface/pulls/1616/commits"},"statuses":{"href":"https://api.github.com/repos/Subsurface-divelog/subsurface/statuses/8e05a24f1b223507c87d4454399cbd3e08585090"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"dirkhh"}}