KARAF-2745 Improve error handling
Protect against NPE