Backport fix for assertion failure due to patch for #20304 (bug 1311275)
We need to backport a fix for an assertion failure that got introduced with the patch for #20304 (moved).
We need to backport a fix for an assertion failure that got introduced with the patch for #20304 (moved).