Fixes #36419. Co-authored-by: Andrii Doroshenko (Xrayez) <xrayez@gmail.com> (cherry picked from commit 0d772c6e6ecf210fa5b38df790b448cb80d4eb8c)