core: fix potential exception case in SSHExec middleware