500 error if entity not found

Created on 15 September 2021, over 3 years ago
Updated 20 January 2025, 3 months ago

Problem/Motivation

On the 8.x-1.x branch, for the rate.vote and rate.undo_vote routes there's a 500 error if the entity doesn't exist.

Error: Call to a member function bundle() on null in Drupal\rate\RateVote->vote() (line 112 of /app/web/modules/contrib/rate/src/RateVote.php)

It's not likely users will stumble into this accidentally, but Google Search Console noticed after some nodes were deleted.

Steps to reproduce

Go to /rate/node/[ID]/updown/-1/yesno or similar where the [ID] is for a node that doesn't exist.

Proposed resolution

A 404 error should be thrown instead.

πŸ› Bug report
Status

Closed: won't fix

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States cantrellnm

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024