diff --git a/app/src/main/java/com/img/rabbit/pages/screen/make/CutoutScreen.kt b/app/src/main/java/com/img/rabbit/pages/screen/make/CutoutScreen.kt index 7b48624..fb5d9df 100644 --- a/app/src/main/java/com/img/rabbit/pages/screen/make/CutoutScreen.kt +++ b/app/src/main/java/com/img/rabbit/pages/screen/make/CutoutScreen.kt @@ -209,7 +209,7 @@ fun CutoutScreen(navController: NavController, viewModel: CutoutViewModel = view if(isLoadingCutoutMethodFromService){ // 服务器完成抠图后,再执行本地加载 viewModel.cutoutImageFromService(context, it){isSuccess, croppedBitmap -> - if (isSuccess) { + if (isSuccess && croppedBitmap != null) { cutoutResultBitmap.value = croppedBitmap // 重置头像变换 headTransform.value = TransformState() diff --git a/app/src/main/java/com/img/rabbit/viewmodel/CutoutViewModel.kt b/app/src/main/java/com/img/rabbit/viewmodel/CutoutViewModel.kt index cbcf224..78cfacb 100644 --- a/app/src/main/java/com/img/rabbit/viewmodel/CutoutViewModel.kt +++ b/app/src/main/java/com/img/rabbit/viewmodel/CutoutViewModel.kt @@ -77,10 +77,9 @@ class CutoutViewModel : BaseViewModel() { if (response.status) { Log.i("CutoutViewModel", "抠图成功: ${response.data}") - val resultUrl = Uri.decode(response.data.toString()) // 将 http 替换为 https - //val resultUrl = response.data.toString().replace("http://", "https://") + //val resultUrl = resultUrl.replace("http://", "https://") saveUrlToCache(resultUrl, onResult) } else { errorState.value = ErrorBean(response.code.toString(), response.message.ifEmpty { "抠图失败" })