【家园功能1.1.12】

1、代码优化,防止空指针
back_recharge
duhui 2022-01-05 13:38:55 +08:00
parent fb9f074c17
commit e912f389ca
1 changed files with 3 additions and 2 deletions

View File

@ -31,6 +31,7 @@ import util.StringUtil;
import util.TimeUtils;
import java.util.*;
import java.util.stream.Collectors;
public class CBean2Proto {
private static final Logger LOGGER = LoggerFactory.getLogger(CBean2Proto.class);
@ -1276,7 +1277,7 @@ public class CBean2Proto {
* @return
*/
public static List<CommonProto.ArchitectureInfo> getArchitectureInfoList(User user) throws Exception {
Collection<ArchitectureInfo> infos = user.getPlayerInfoManager().getArchitectureInfoMap().values();
List<ArchitectureInfo> infos = new ArrayList<>(user.getPlayerInfoManager().getArchitectureInfoMap().values());
ArrayList<CommonProto.ArchitectureInfo> list = new ArrayList<>();
Map<Integer, SHomeLandLevel> config = STableManager.getConfig(SHomeLandLevel.class);
for (ArchitectureInfo info : infos) {
@ -1303,7 +1304,7 @@ public class CBean2Proto {
* @return
*/
public static List<CommonProto.LandInfo> getLandInfoList(User user){
Collection<LandInfo> infos = user.getPlayerInfoManager().getLandInfoMap().values();
List<LandInfo> infos = new ArrayList<>(user.getPlayerInfoManager().getLandInfoMap().values());
ArrayList<CommonProto.LandInfo> list = new ArrayList<>();
for (LandInfo info : infos) {
CommonProto.LandInfo.Builder builder = CommonProto.LandInfo.newBuilder()