Open skidder opened 11 months ago
The thumbhash_encoder_create function includes a null-check on the return value from new; however, if new were to fail, the default behavior is to throw an std::bad_alloc exception rather than return null, making the if-condition unreachable.
thumbhash_encoder_create
new
std::bad_alloc
if
https://github.com/discord/lilliput/blob/217a9d5cff47a3310851f1f9239df962c5b2c1bd/thumbhash.cpp#L18-L21
The
thumbhash_encoder_create
function includes a null-check on the return value fromnew
; however, ifnew
were to fail, the default behavior is to throw anstd::bad_alloc
exception rather than return null, making theif
-condition unreachable.https://github.com/discord/lilliput/blob/217a9d5cff47a3310851f1f9239df962c5b2c1bd/thumbhash.cpp#L18-L21