Issue #12664: Prevent crash when multiple channels are copied
This patch attempts to resolve #12664 (closed), based on @tmanni's diagnosis.
Currently, we do not handle copying multiple channels. The function call returns NULL but does not set an error message - this causes a crash when we try to print out error->message.
This patch changes the g_return_val_if_fail () call to an IF statement, so that we can initialize the error object with a message to prevent the crash.
Note that this creates a new string, so we'll need to post on https://discourse.gnome.org/t/gimps-master-branch-string-freeze/22895 once approved.