Fixed calculation of module dependency list

When looking for dependent modules the code was accepting all cases
where a process name was specified (i.e. the pointer was non zero)
rather than taking all cases when it was not specified (pointer 0).
Merge pull request #4406 from Dr15Jones/fixDependentModuleCheck

Fixed calculation of module dependency list