瀏覽代碼

refactoring

Daniel Gatis 2 年之前
父節點
當前提交
dc45a477b2
共有 1 個文件被更改,包括 5 次插入4 次删除
  1. 5 4
      rembg/commands/s_command.py

+ 5 - 4
rembg/commands/s_command.py

@@ -175,10 +175,11 @@ def s_command(port: int, log_level: str, threads: int) -> None:
     def im_without_bg(content: bytes, commons: CommonQueryParams) -> Response:
         kwargs = dict()
 
-        try:
-            kwargs.update(json.loads(commons.extras))
-        except Exception:
-            pass
+        if commons.extras:
+            try:
+                kwargs.update(json.loads(commons.extras))
+            except Exception:
+                pass
 
         return Response(
             remove(