Problem/Motivation
Drupal version is 10.2.3, PHP is 8.2.
Function, called inside GDToolkit::load() may return FALSE in case of error. System checks execution with try/catch, but doesn't check, if $image is not FALSE. This leads to the error TypeError: Drupal\system\Plugin\ImageToolkit\GDToolkit::setImage(): Argument #1 ($image) must be of type ?GdImage, bool given, called in /web/core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php on line 284 in Drupal\system\Plugin\ImageToolkit\GDToolkit->setImage() (line 201 of /web/core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php).
.
Steps to reproduce
I don't have exact steps to reproduce, because locally I can get error only if I hacking code in order to raise such situation.
Proposed resolution
Add checking for boolean result of the function.
Remaining tasks
provide MR/patch, review, give feedback, merge if possible.