Merge pull request #1088 from yuhan6665/import-fix

Fix a null pointer when subscribe link doesn't have sni field
This commit is contained in:
2dust
2021-06-07 08:17:13 +08:00
committed by GitHub
@@ -192,6 +192,7 @@ object AngConfigManager {
return R.string.toast_decoding_failed
}
val vmessQRCode = Gson().fromJson(result, VmessQRCode::class.java)
// Although VmessQRCode fields are non null, looks like Gson may still create null fields
if (TextUtils.isEmpty(vmessQRCode.add)
|| TextUtils.isEmpty(vmessQRCode.port)
|| TextUtils.isEmpty(vmessQRCode.id)
@@ -212,7 +213,7 @@ object AngConfigManager {
val sni = streamSetting.populateTransportSettings(vmessQRCode.net, vmessQRCode.type, vmessQRCode.host,
vmessQRCode.path, vmessQRCode.path, vmessQRCode.host, vmessQRCode.path, vmessQRCode.type, vmessQRCode.path)
streamSetting.populateTlsSettings(vmessQRCode.tls, allowInsecure,
if (vmessQRCode.sni.isNotBlank()) vmessQRCode.sni else sni)
if (TextUtils.isEmpty(vmessQRCode.sni)) sni else vmessQRCode.sni)
}
}
} else if (str.startsWith(EConfigType.SHADOWSOCKS.protocolScheme)) {