Added null check for portType and methods[methodname].output

pull request with one commit