1. Check if active document is  null before use it :)