In unit test if_fail check for nullptr is always located after dereferencing this null pointer. This patch introduces correct order: first check, then use