Fix split-string(nil) in gerrit-dashboard--cell-formatter#60
Open
whame wants to merge 1 commit intotwmr:masterfrom
Open
Fix split-string(nil) in gerrit-dashboard--cell-formatter#60whame wants to merge 1 commit intotwmr:masterfrom
whame wants to merge 1 commit intotwmr:masterfrom
Conversation
If `gerrit-dashboard` is called and a `reviewer-account-id` cannot be
found from `(gerrit-get-accounts-alist)`,
`gerrit-dashboard--cell-formatter` calls `split-string` with a `nil`
value. The following captured stack trace can be captured in this case (edited for readability):
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
split-string(nil)
...
gerrit-dashboard--cell-formatter(... "Reviewers")
...
gerrit-dashboard--change-metadata-2-entry(...)
...
gerrit-dashboard--get-data("has:draft")
...
gerrit-dashboard--get-list-entries()
gerrit-dashboard--refresh()
gerrit-dashboard-mode()
gerrit-dashboard()
funcall-interactively(gerrit-dashboard)
command-execute(gerrit-dashboard record)
execute-extended-command(nil "gerrit-dashboard" "gerr")
funcall-interactively(execute-extended-command nil "gerrit-dashboard" "gerr")
command-execute(execute-extended-command)
The above was triggered for the "Reviewers" column in
`gerrit-dashboard--cell-formatter`. This could for instance happen if a
user is removed from the Gerrit instance's database but the
`change-metadata` still list them (at least that's what I think has
happened on my instance).
Fix this by instead returning "N/A" as name if `reviewer-account-id`
can't be found in `(gerrit-get-accounts-alist)`. There is only one other
place where `(gerrit-get-accounts-alist)` is called and checked in a
similar way, the "CC" column. While this column hasn't triggered this
error, it doesn't hurt to be defensive and fix it here also.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If
gerrit-dashboardis called and areviewer-account-idcannot be found from(gerrit-get-accounts-alist),gerrit-dashboard--cell-formattercallssplit-stringwith anilvalue. The following captured stack trace can be captured in this case (edited for readability):The above was triggered for the "Reviewers" column in
gerrit-dashboard--cell-formatter. This could for instance happen if a user is removed from the Gerrit instance's database but thechange-metadatastill list them (at least that's what I think has happened on my instance).Fix this by instead returning "N/A" as name if
reviewer-account-idcan't be found in(gerrit-get-accounts-alist). There is only one other place where(gerrit-get-accounts-alist)is called and checked in a similar way, the "CC" column. While this column hasn't triggered this error, it doesn't hurt to be defensive and fix it here also.