refactoring and null protecting get image src