Commit 10d7bbb577db858f0d18c823258e7648a8d158df
Merge branch 'cherry-pick-dd1ddc1b' into 'master_dev'
fix: 更新设备扩展信息空指针,保证sip信息在更新时不会被覆盖 See merge request yunteng/thingskit!354
Showing
1 changed file
with
6 additions
and
4 deletions
... | ... | @@ -84,10 +84,12 @@ public class TkDeviceServiceImpl extends AbstractBaseService<DeviceMapper, TkDev |
84 | 84 | //更改了产品,需将原产品的缓存置为无效 |
85 | 85 | cacheUtils.invalidate(cacheName,deviceDTO.getTenantId()+","+entity.getProfileId()); |
86 | 86 | } |
87 | - Optional.ofNullable(db.getDeviceInfo().get(FastIotConstants.DeviceAdditional.SIP)).ifPresent(sip ->{ | |
88 | - ObjectNode additional = (ObjectNode) deviceDTO.getDeviceInfo(); | |
89 | - additional.set(FastIotConstants.DeviceAdditional.SIP,sip); | |
90 | - }); | |
87 | + if(null !=db.getDeviceInfo()){ | |
88 | + Optional.ofNullable(db.getDeviceInfo().get(FastIotConstants.DeviceAdditional.SIP)).ifPresent(sip ->{ | |
89 | + ObjectNode additional = (ObjectNode) deviceDTO.getDeviceInfo(); | |
90 | + additional.set(FastIotConstants.DeviceAdditional.SIP,sip); | |
91 | + }); | |
92 | + } | |
91 | 93 | }); |
92 | 94 | TkDeviceEntity device = new TkDeviceEntity(); |
93 | 95 | deviceDTO.copyToEntity( | ... | ... |