Core/Misc: Fix assertion triggered

Change an assertion added in 6dcd8c8545a65a7bfbd0daaa16f650d8c3a90262 with a NULL check, properly handling the case of a NULL parameter.
Fixes #11771