- Moved NULL check before dereferencing