Issue #6033
In #6033 (closed) is attached a patch. This is an improved patch.
The logic for the precondition is sufficiently complex that I added a comment.
I changed the annotations, and reformatted them.
In the original patch, I changed gint=>guint. I don't understand why a length of an array could be negative, but using gint is common in the GIMP code, I decided not to change it in this MR, it would give compiler warnings.
The MR is important because it affects some scripts and Python plugins that call the PDB. I keep seeing the issue in my testing, and I imagine others will see it also.