This PR fixes another situation where a crash occurs thanks to @krishnasrinivas for reproducing this Fixes #5897