Check if error if not NULL before using it and fix a comment