Fix some coverity issues.
TRQ-2971. Add an additional check for an appropriate value.