Browse Source

Fix binary object marshalling, closes #9472

Juan Linietsky 8 years ago
parent
commit
1be30f35a6
1 changed files with 6 additions and 1 deletions
  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) {