Fixes NPE in PreviewDatabaseFilter when mainObject is null.