Fix astropy/astropy#4218 -- fix crash in smart_resolver when lookup fails