Ensure we have a list of valid ids before trying to retrieve them from the database.
Merge branch 'dev' into contao3