WordPoints / wordpoints

Points plugin for WordPress
GNU General Public License v2.0
20 stars 15 forks source link

Ranks: don't fatal when rank type doesn't exist #744

Closed JDGrimes closed 6 years ago

JDGrimes commented 7 years ago

I received a report last week about the ranks component giving a fatal error. This was coming from the WordPoints_Rank_Type::maybe_increase_user_rank() method, because WordPoints_Rank_Types::get_type( $next_rank->type ). I have not yet determined why the rank type didn't exist in this case, but I think that it makes sense to avoid a fatal error here by adding a sanity check.

JDGrimes commented 6 years ago

It does seem like we should give some kind of error here though. Otherwise, it will fail silently, making debugging a nightmare. And the problem might not even be noticed at all in that case. Of course, a problem like this should never happen in the first place. Yet here we are. (And I still don't know what was causing this issue in the first place.)

JDGrimes commented 6 years ago

I've decided to just fix the fatal error for now, and we'll revisit it further as needed.