STM32F303VC I2C works in Debug mode only
That loop will simply not work. The HDC_TIMEOUT_UserCallback() gets called on the first itertion if HDC_Timeout is non-zero, and on the second one if it is zero. Whoever created this one never tried it on real hardware.

It may work in single-step debugging because the I2C_ISR_RXNE flag will be set before this code is executed, and the while() condition is already false.

Note that there is not only the condition inverted in the if () but also no significant delay between loop cycles.