[FixRM #8322] - Fix undefined method code error due to a timeout

res needs to be checked before accessing method code(), see:
http://dev.metasploit.com/redmine/issues/8322