Fix possible traceback.

Ticket: #6969