1
mirror of https://github.com/CarmJos/EasyConfiguration.git synced 2024-09-19 20:25:51 +00:00

fix(list): 允许出现长度为0的List (#23)

This commit is contained in:
冬花ice 2023-02-19 16:49:25 +08:00 committed by GitHub
parent 9e3dff3e95
commit b756074ddc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,8 +38,9 @@ public class ConfiguredList<V> extends CachedConfigValue<List<V>> {
public @NotNull List<V> get() {
if (isExpired()) { // 已过时的数据需要重新解析一次
List<V> list = new ArrayList<>();
List<?> data = getConfiguration().getList(getConfigPath());
if (data == null || data.isEmpty()) return useOrDefault(list);
List<?> data = getConfiguration().contains(getConfigPath()) ?
getConfiguration().getList(getConfigPath()) : null;
if (data == null) return useOrDefault(list);
for (Object dataVal : data) {
if (dataVal == null) continue;
try {