{"action":"created","comment":{"url":"https://api.github.com/repos/ArduPilot/ardupilot/pulls/comments/93221682","pull_request_review_id":13743175,"id":93221682,"diff_hunk":"@@ -122,17 +122,20 @@ bool AP_Mission::starts_with_takeoff_cmd()\n     // get starting point for search or Reset cmd_index, if _restart is set\n     cmd_index = _restart ? AP_MISSION_CMD_INDEX_NONE : _nav_cmd.index;\n \n-    if (cmd_index == AP_MISSION_CMD_INDEX_NONE) {\n-        // start from beginning of the mission command list\n-        cmd_index = AP_MISSION_FIRST_REAL_COMMAND;\n-        if (!get_next_cmd(cmd_index, cmd, true)) {\n-            return false;\n-        }\n-    } else {\n-        if (!read_cmd_from_storage(cmd_index, cmd)) {\n-            return false;\n+    do {\n+        if (cmd_index == AP_MISSION_CMD_INDEX_NONE) {\n+            // start from beginning of the mission command list\n+            cmd_index = AP_MISSION_FIRST_REAL_COMMAND;\n+            if (!get_next_cmd(cmd_index, cmd, true)) {\n+                return false;\n+            }\n+        } else {\n+            if (!read_cmd_from_storage(cmd_index, cmd)) {\n+                return false;\n+            }\n         }\n-    }\n+        cmd_index++; // in case we iterate\n+    } while (!is_nav_cmd(cmd));","path":"libraries/AP_Mission/AP_Mission.cpp","position":27,"original_position":27,"commit_id":"dfbeea9f60f0f300fa06fe6a77d5ae11a79b844d","original_commit_id":"41046df0cd8ded723ae1d67be0a62985f7b2968c","user":{"login":"peterbarker","id":7077857,"avatar_url":"https://avatars.githubusercontent.com/u/7077857?v=3","gravatar_id":"","url":"https://api.github.com/users/peterbarker","html_url":"https://github.com/peterbarker","followers_url":"https://api.github.com/users/peterbarker/followers","following_url":"https://api.github.com/users/peterbarker/following{/other_user}","gists_url":"https://api.github.com/users/peterbarker/gists{/gist_id}","starred_url":"https://api.github.com/users/peterbarker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterbarker/subscriptions","organizations_url":"https://api.github.com/users/peterbarker/orgs","repos_url":"https://api.github.com/users/peterbarker/repos","events_url":"https://api.github.com/users/peterbarker/events{/privacy}","received_events_url":"https://api.github.com/users/peterbarker/received_events","type":"User","site_admin":false},"body":"cmd_index is always incremented.\r\n\r\nThe first clause in the `if` block makes sure the mission list isn't empty.\r\n\r\nAt some stage read_cmd_from_storage will fail as cmd_index gets high enough.\r\n\r\nI think its good.\r\n\r\n","created_at":"2016-12-20T11:47:39Z","updated_at":"2016-12-20T11:47:39Z","html_url":"https://github.com/ArduPilot/ardupilot/pull/5418#discussion_r93221682","pull_request_url":"https://api.github.com/repos/ArduPilot/ardupilot/pulls/5418","_links":{"self":{"href":"https://api.github.com/repos/ArduPilot/ardupilot/pulls/comments/93221682"},"html":{"href":"https://github.com/ArduPilot/ardupilot/pull/5418#discussion_r93221682"},"pull_request":{"href":"https://api.github.com/repos/ArduPilot/ardupilot/pulls/5418"}}},"pull_request":{"url":"https://api.github.com/repos/ArduPilot/ardupilot/pulls/5418","id":98688339,"html_url":"https://github.com/ArduPilot/ardupilot/pull/5418","diff_url":"https://github.com/ArduPilot/ardupilot/pull/5418.diff","patch_url":"https://github.com/ArduPilot/ardupilot/pull/5418.patch","issue_url":"https://api.github.com/repos/ArduPilot/ardupilot/issues/5418","number":5418,"state":"open","locked":false,"title":"Gripper testing fixes","user":{"login":"peterbarker","id":7077857,"avatar_url":"https://avatars.githubusercontent.com/u/7077857?v=3","gravatar_id":"","url":"https://api.github.com/users/peterbarker","html_url":"https://github.com/peterbarker","followers_url":"https://api.github.com/users/peterbarker/followers","following_url":"https://api.github.com/users/peterbarker/following{/other_user}","gists_url":"https://api.github.com/users/peterbarker/gists{/gist_id}","starred_url":"https://api.github.com/users/peterbarker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterbarker/subscriptions","organizations_url":"https://api.github.com/users/peterbarker/orgs","repos_url":"https://api.github.com/users/peterbarker/repos","events_url":"https://api.github.com/users/peterbarker/events{/privacy}","received_events_url":"https://api.github.com/users/peterbarker/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-12-20T05:22:00Z","updated_at":"2016-12-20T11:47:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"783f0165aad9bf44a04684127ca7798f2978a5b4","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ArduPilot/ardupilot/pulls/5418/commits","review_comments_url":"https://api.github.com/repos/ArduPilot/ardupilot/pulls/5418/comments","review_comment_url":"https://api.github.com/repos/ArduPilot/ardupilot/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ArduPilot/ardupilot/issues/5418/comments","statuses_url":"https://api.github.com/repos/ArduPilot/ardupilot/statuses/dfbeea9f60f0f300fa06fe6a77d5ae11a79b844d","head":{"label":"peterbarker:gripper-testing-fixes","ref":"gripper-testing-fixes","sha":"dfbeea9f60f0f300fa06fe6a77d5ae11a79b844d","user":{"login":"peterbarker","id":7077857,"avatar_url":"https://avatars.githubusercontent.com/u/7077857?v=3","gravatar_id":"","url":"https://api.github.com/users/peterbarker","html_url":"https://github.com/peterbarker","followers_url":"https://api.github.com/users/peterbarker/followers","following_url":"https://api.github.com/users/peterbarker/following{/other_user}","gists_url":"https://api.github.com/users/peterbarker/gists{/gist_id}","starred_url":"https://api.github.com/users/peterbarker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterbarker/subscriptions","organizations_url":"https://api.github.com/users/peterbarker/orgs","repos_url":"https://api.github.com/users/peterbarker/repos","events_url":"https://api.github.com/users/peterbarker/events{/privacy}","received_events_url":"https://api.github.com/users/peterbarker/received_events","type":"User","site_admin":false},"repo":{"id":34165570,"name":"ardupilot","full_name":"peterbarker/ardupilot","owner":{"login":"peterbarker","id":7077857,"avatar_url":"https://avatars.githubusercontent.com/u/7077857?v=3","gravatar_id":"","url":"https://api.github.com/users/peterbarker","html_url":"https://github.com/peterbarker","followers_url":"https://api.github.com/users/peterbarker/followers","following_url":"https://api.github.com/users/peterbarker/following{/other_user}","gists_url":"https://api.github.com/users/peterbarker/gists{/gist_id}","starred_url":"https://api.github.com/users/peterbarker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterbarker/subscriptions","organizations_url":"https://api.github.com/users/peterbarker/orgs","repos_url":"https://api.github.com/users/peterbarker/repos","events_url":"https://api.github.com/users/peterbarker/events{/privacy}","received_events_url":"https://api.github.com/users/peterbarker/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/peterbarker/ardupilot","description":"APM Plane, APM Copter, APM Rover source","fork":true,"url":"https://api.github.com/repos/peterbarker/ardupilot","forks_url":"https://api.github.com/repos/peterbarker/ardupilot/forks","keys_url":"https://api.github.com/repos/peterbarker/ardupilot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/peterbarker/ardupilot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/peterbarker/ardupilot/teams","hooks_url":"https://api.github.com/repos/peterbarker/ardupilot/hooks","issue_events_url":"https://api.github.com/repos/peterbarker/ardupilot/issues/events{/number}","events_url":"https://api.github.com/repos/peterbarker/ardupilot/events","assignees_url":"https://api.github.com/repos/peterbarker/ardupilot/assignees{/user}","branches_url":"https://api.github.com/repos/peterbarker/ardupilot/branches{/branch}","tags_url":"https://api.github.com/repos/peterbarker/ardupilot/tags","blobs_url":"https://api.github.com/repos/peterbarker/ardupilot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/peterbarker/ardupilot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/peterbarker/ardupilot/git/refs{/sha}","trees_url":"https://api.github.com/repos/peterbarker/ardupilot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/peterbarker/ardupilot/statuses/{sha}","languages_url":"https://api.github.com/repos/peterbarker/ardupilot/languages","stargazers_url":"https://api.github.com/repos/peterbarker/ardupilot/stargazers","contributors_url":"https://api.github.com/repos/peterbarker/ardupilot/contributors","subscribers_url":"https://api.github.com/repos/peterbarker/ardupilot/subscribers","subscription_url":"https://api.github.com/repos/peterbarker/ardupilot/subscription","commits_url":"https://api.github.com/repos/peterbarker/ardupilot/commits{/sha}","git_commits_url":"https://api.github.com/repos/peterbarker/ardupilot/git/commits{/sha}","comments_url":"https://api.github.com/repos/peterbarker/ardupilot/comments{/number}","issue_comment_url":"https://api.github.com/repos/peterbarker/ardupilot/issues/comments{/number}","contents_url":"https://api.github.com/repos/peterbarker/ardupilot/contents/{+path}","compare_url":"https://api.github.com/repos/peterbarker/ardupilot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/peterbarker/ardupilot/merges","archive_url":"https://api.github.com/repos/peterbarker/ardupilot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/peterbarker/ardupilot/downloads","issues_url":"https://api.github.com/repos/peterbarker/ardupilot/issues{/number}","pulls_url":"https://api.github.com/repos/peterbarker/ardupilot/pulls{/number}","milestones_url":"https://api.github.com/repos/peterbarker/ardupilot/milestones{/number}","notifications_url":"https://api.github.com/repos/peterbarker/ardupilot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/peterbarker/ardupilot/labels{/name}","releases_url":"https://api.github.com/repos/peterbarker/ardupilot/releases{/id}","deployments_url":"https://api.github.com/repos/peterbarker/ardupilot/deployments","created_at":"2015-04-18T12:46:36Z","updated_at":"2016-11-30T01:59:51Z","pushed_at":"2016-12-20T11:42:55Z","git_url":"git://github.com/peterbarker/ardupilot.git","ssh_url":"git@github.com:peterbarker/ardupilot.git","clone_url":"https://github.com/peterbarker/ardupilot.git","svn_url":"https://github.com/peterbarker/ardupilot","homepage":"http://ardupilot.com/","size":81398,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ArduPilot:master","ref":"master","sha":"dbbf6cae5c6f5e534a4901f72c647d953b83d5f8","user":{"login":"ArduPilot","id":17919847,"avatar_url":"https://avatars.githubusercontent.com/u/17919847?v=3","gravatar_id":"","url":"https://api.github.com/users/ArduPilot","html_url":"https://github.com/ArduPilot","followers_url":"https://api.github.com/users/ArduPilot/followers","following_url":"https://api.github.com/users/ArduPilot/following{/other_user}","gists_url":"https://api.github.com/users/ArduPilot/gists{/gist_id}","starred_url":"https://api.github.com/users/ArduPilot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArduPilot/subscriptions","organizations_url":"https://api.github.com/users/ArduPilot/orgs","repos_url":"https://api.github.com/users/ArduPilot/repos","events_url":"https://api.github.com/users/ArduPilot/events{/privacy}","received_events_url":"https://api.github.com/users/ArduPilot/received_events","type":"Organization","site_admin":false},"repo":{"id":7512484,"name":"ardupilot","full_name":"ArduPilot/ardupilot","owner":{"login":"ArduPilot","id":17919847,"avatar_url":"https://avatars.githubusercontent.com/u/17919847?v=3","gravatar_id":"","url":"https://api.github.com/users/ArduPilot","html_url":"https://github.com/ArduPilot","followers_url":"https://api.github.com/users/ArduPilot/followers","following_url":"https://api.github.com/users/ArduPilot/following{/other_user}","gists_url":"https://api.github.com/users/ArduPilot/gists{/gist_id}","starred_url":"https://api.github.com/users/ArduPilot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArduPilot/subscriptions","organizations_url":"https://api.github.com/users/ArduPilot/orgs","repos_url":"https://api.github.com/users/ArduPilot/repos","events_url":"https://api.github.com/users/ArduPilot/events{/privacy}","received_events_url":"https://api.github.com/users/ArduPilot/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ArduPilot/ardupilot","description":"ArduPlane, ArduCopter, ArduRover source","fork":false,"url":"https://api.github.com/repos/ArduPilot/ardupilot","forks_url":"https://api.github.com/repos/ArduPilot/ardupilot/forks","keys_url":"https://api.github.com/repos/ArduPilot/ardupilot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ArduPilot/ardupilot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ArduPilot/ardupilot/teams","hooks_url":"https://api.github.com/repos/ArduPilot/ardupilot/hooks","issue_events_url":"https://api.github.com/repos/ArduPilot/ardupilot/issues/events{/number}","events_url":"https://api.github.com/repos/ArduPilot/ardupilot/events","assignees_url":"https://api.github.com/repos/ArduPilot/ardupilot/assignees{/user}","branches_url":"https://api.github.com/repos/ArduPilot/ardupilot/branches{/branch}","tags_url":"https://api.github.com/repos/ArduPilot/ardupilot/tags","blobs_url":"https://api.github.com/repos/ArduPilot/ardupilot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ArduPilot/ardupilot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ArduPilot/ardupilot/git/refs{/sha}","trees_url":"https://api.github.com/repos/ArduPilot/ardupilot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ArduPilot/ardupilot/statuses/{sha}","languages_url":"https://api.github.com/repos/ArduPilot/ardupilot/languages","stargazers_url":"https://api.github.com/repos/ArduPilot/ardupilot/stargazers","contributors_url":"https://api.github.com/repos/ArduPilot/ardupilot/contributors","subscribers_url":"https://api.github.com/repos/ArduPilot/ardupilot/subscribers","subscription_url":"https://api.github.com/repos/ArduPilot/ardupilot/subscription","commits_url":"https://api.github.com/repos/ArduPilot/ardupilot/commits{/sha}","git_commits_url":"https://api.github.com/repos/ArduPilot/ardupilot/git/commits{/sha}","comments_url":"https://api.github.com/repos/ArduPilot/ardupilot/comments{/number}","issue_comment_url":"https://api.github.com/repos/ArduPilot/ardupilot/issues/comments{/number}","contents_url":"https://api.github.com/repos/ArduPilot/ardupilot/contents/{+path}","compare_url":"https://api.github.com/repos/ArduPilot/ardupilot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ArduPilot/ardupilot/merges","archive_url":"https://api.github.com/repos/ArduPilot/ardupilot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ArduPilot/ardupilot/downloads","issues_url":"https://api.github.com/repos/ArduPilot/ardupilot/issues{/number}","pulls_url":"https://api.github.com/repos/ArduPilot/ardupilot/pulls{/number}","milestones_url":"https://api.github.com/repos/ArduPilot/ardupilot/milestones{/number}","notifications_url":"https://api.github.com/repos/ArduPilot/ardupilot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ArduPilot/ardupilot/labels{/name}","releases_url":"https://api.github.com/repos/ArduPilot/ardupilot/releases{/id}","deployments_url":"https://api.github.com/repos/ArduPilot/ardupilot/deployments","created_at":"2013-01-09T00:58:52Z","updated_at":"2016-12-20T07:55:33Z","pushed_at":"2016-12-20T11:42:57Z","git_url":"git://github.com/ArduPilot/ardupilot.git","ssh_url":"git@github.com:ArduPilot/ardupilot.git","clone_url":"https://github.com/ArduPilot/ardupilot.git","svn_url":"https://github.com/ArduPilot/ardupilot","homepage":"http://ardupilot.org/","size":80373,"stargazers_count":2232,"watchers_count":2232,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4745,"mirror_url":null,"open_issues_count":889,"forks":4745,"open_issues":889,"watchers":2232,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ArduPilot/ardupilot/pulls/5418"},"html":{"href":"https://github.com/ArduPilot/ardupilot/pull/5418"},"issue":{"href":"https://api.github.com/repos/ArduPilot/ardupilot/issues/5418"},"comments":{"href":"https://api.github.com/repos/ArduPilot/ardupilot/issues/5418/comments"},"review_comments":{"href":"https://api.github.com/repos/ArduPilot/ardupilot/pulls/5418/comments"},"review_comment":{"href":"https://api.github.com/repos/ArduPilot/ardupilot/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ArduPilot/ardupilot/pulls/5418/commits"},"statuses":{"href":"https://api.github.com/repos/ArduPilot/ardupilot/statuses/dfbeea9f60f0f300fa06fe6a77d5ae11a79b844d"}}}}
{"actor":{"display_login":"peterbarker"}}