Fix unhandled exception in sql execution.

It's possible that thetvdb has a show but doesn't have the imdbId for it, in that case if we try to cache it, the sql execution will cause an unhandled exception.