Merge "Check NPE beforehand instead of catching it at runtime" into cw-e-dev