Fix #18254

(cherry picked from commit e4296a68b2eee9420ea21beb5b3fb7c1f6e9a8f6)