浏览代码

Make `strconv` more robust

gingerBill 3 年之前
父节点
当前提交
1d7c9cf872
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      core/strconv/strconv.odin

+ 3 - 1
core/strconv/strconv.odin

@@ -882,7 +882,9 @@ unquote_string :: proc(lit: string, allocator := context.allocator) -> (res: str
 		return -1
 	}
 
-	assert(len(lit) >= 2)
+	if len(lit) < 2 {
+		return
+	}
 	if lit[0] == '`' {
 		return lit[1:len(lit)-1], false, true
 	}