Fixes #19652. (cherry picked from commit ffcd6838) (cherry picked from commit 9a24f5ed)
mentioned in commit f8cb5d4d