Fix the coverity issues

This PR is to resolve issues raised by coverity.

BUG=XWALK-2928
The error message isn't very helpful, you can just return false here.