Merge branch 'bug/NPE-empty-children-DSL' into 'release'

NPE : In case the children tag exists in the DSL but is empty, we shouldnt try to extract widget names

See merge request theappsmith/internal-tools-server!290
This commit is contained in:
Trisha Anand 2020-04-20 09:22:51 +00:00
commit 3b10a444f0

View File

@ -19,6 +19,7 @@ import net.minidev.json.parser.JSONParser;
import net.minidev.json.parser.ParseException;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import reactor.core.publisher.Flux;
@ -432,8 +433,11 @@ public class LayoutActionServiceImpl implements LayoutActionService {
for (int i = 0; i < children.size(); i++) {
Map data = (Map) children.get(i);
JSONObject object = new JSONObject();
object.putAll(data);
extractAllWidgetNamesFromDSL(object, widgetNames);
// If the children tag exists and there are entries within it
if (!CollectionUtils.isEmpty(data)) {
object.putAll(data);
extractAllWidgetNamesFromDSL(object, widgetNames);
}
}
}
}