chore: NPE issue while copying in git-theming migration (#15480)

## Description

> Fix the NPE issue in theming while copying the properties. 


## Type of change

- Bug fix (non-breaking change which fixes an issue)

## How Has This Been Tested?

> Locally

## Checklist:

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
This commit is contained in:
Anagh Hegde 2022-07-27 17:14:17 +05:30 committed by Rishabh-Rathod
parent 91025f94d7
commit 505d3a331d

View File

@ -71,6 +71,7 @@ import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static com.appsmith.external.helpers.AppsmithBeanUtils.copyNestedNonNullProperties;
import static com.appsmith.external.helpers.AppsmithBeanUtils.copyNewFieldValuesIntoOldObject;
import static com.appsmith.server.migrations.DatabaseChangelog.dropIndexIfExists;
import static com.appsmith.server.migrations.DatabaseChangelog.ensureIndexes;
@ -1439,7 +1440,7 @@ public class DatabaseChangelog2 {
Theme theme = mongockTemplate.findOne(themeQuery, Theme.class);
for (Application application : applicationList) {
Theme newTheme = new Theme();
copyNewFieldValuesIntoOldObject(theme, newTheme);
copyNestedNonNullProperties(theme, newTheme);
newTheme.setId(null);
newTheme.setSystemTheme(false);
newTheme = mongockTemplate.insert(newTheme);