浏览代码

Merge pull request #41029 from masi456/fix/40888

Make sure that Image is not locked before creation
Rémi Verschelde 5 年之前
父节点
当前提交
42dca43c50
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      core/image.cpp

+ 1 - 0
core/image.cpp

@@ -1586,6 +1586,7 @@ void Image::create(int p_width, int p_height, bool p_use_mipmaps, Format p_forma
 	ERR_FAIL_COND_MSG(p_height <= 0, "Image height must be greater than 0.");
 	ERR_FAIL_COND_MSG(p_width > MAX_WIDTH, "Image width cannot be greater than " + itos(MAX_WIDTH) + ".");
 	ERR_FAIL_COND_MSG(p_height > MAX_HEIGHT, "Image height cannot be greater than " + itos(MAX_HEIGHT) + ".");
+	ERR_FAIL_COND_MSG(write_lock.ptr(), "Cannot create image when it is locked.");
 
 	int mm = 0;
 	int size = _get_dst_image_size(p_width, p_height, p_format, mm, p_use_mipmaps ? -1 : 0);