Skip to content

#1646: guard Integer(pull.dig(:user, :id)) against nil on deleted PR author#1817

Open
VasilevNStas wants to merge 1 commit into
zerocracy:masterfrom
VasilevNStas:1646-Integer-nil
Open

#1646: guard Integer(pull.dig(:user, :id)) against nil on deleted PR author#1817
VasilevNStas wants to merge 1 commit into
zerocracy:masterfrom
VasilevNStas:1646-Integer-nil

Conversation

@VasilevNStas

Copy link
Copy Markdown
Contributor

Closes #1646

On PullRequestReviewEvent, line 279 reads:

skip(json) if Integer(pull.dig(:user, :id)) == fact.who

If the PR author's GitHub account was deleted, :user is nil and Integer(nil) raises TypeError: can't convert nil into Integer. This crashes the judge mid-iteration and skips all remaining repos.

Fix: use &.to_i instead of Integer(). nil&.to_i returns nil, and nil == fact.who is false, so we don't skip and continue processing. The pull-was-merged.rb case (Integer(actor[:id]) at line 115) is already guarded by if actor on line 117.

@VasilevNStas

Copy link
Copy Markdown
Contributor Author

@yegor256 plz review

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.

github-events.rb:279 Integer(pull.dig(:user, :id)) crashes on deleted PR author

1 participant