Fix null reference exception during "kpm pack --runtime"

parent #684 
Agree. It's also true for `PackProject` and `PackPackage`. I'll fix them in another PR #686