浏览代码

Fix binary object marshalling, closes #9472

Juan Linietsky 8 年之前
父节点
当前提交
1be30f35a6
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      core/io/marshalls.cpp

+ 6 - 1
core/io/marshalls.cpp

@@ -807,11 +807,16 @@ static void _encode_string(const String &p_string, uint8_t *&buf, int &r_len) {
 		encode_uint32(utf8.length(), buf);
 		buf += 4;
 		copymem(buf, utf8.get_data(), utf8.length());
+		buf += utf8.length();
 	}
 
 	r_len += 4 + utf8.length();
-	while (r_len % 4)
+	while (r_len % 4) {
 		r_len++; //pad
+		if (buf) {
+			buf++;
+		}
+	}
 }
 
 Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bool p_object_as_id) {