瀏覽代碼

chore: someting

GyDi 3 年之前
父節點
當前提交
860c44e93d
共有 1 個文件被更改,包括 4 次插入5 次删除
  1. 4 5
      src-tauri/src/utils/fetch.rs

+ 4 - 5
src-tauri/src/utils/fetch.rs

@@ -32,11 +32,10 @@ pub async fn fetch_profile(url: &str) -> Option<ProfileResponse> {
 
   // parse the Subscription Userinfo
   let extra = {
-    let sub_info = header
-      .get("Subscription-Userinfo")
-      .unwrap()
-      .to_str()
-      .unwrap();
+    let sub_info = match header.get("Subscription-Userinfo") {
+      Some(value) => value.to_str().unwrap_or(""),
+      None => "",
+    };
 
     ProfileExtra {
       upload: parse_string(sub_info, "upload=").unwrap_or(0),