Prevent watchdog and warnings from lack of theme hook.

From #5417.

Against 3.11