Skip to content

Fix split-string(nil) in gerrit-dashboard--cell-formatter#60

Open
whame wants to merge 1 commit intotwmr:masterfrom
whame:master
Open

Fix split-string(nil) in gerrit-dashboard--cell-formatter#60
whame wants to merge 1 commit intotwmr:masterfrom
whame:master

Conversation

@whame
Copy link
Copy Markdown

@whame whame commented Apr 13, 2026

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant