API: Fix regression from r32224 with caused bug 18597 (internal error for empty gener...