Skip to content

Commit

Permalink
Fix raw object decoding with no data.
Browse files Browse the repository at this point in the history
  • Loading branch information
Faless committed Aug 12, 2021
1 parent 1fbd39e commit 6ab1c1b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 0 additions & 2 deletions core/io/multiplayer_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1044,8 +1044,6 @@ Node *MultiplayerAPI::get_cached_node(int p_from, uint32_t p_node_id) {
ERR_FAIL_COND_V_MSG(!F, nullptr, vformat("ID %d not found in cache of peer %d.", p_node_id, p_from));

PathGetCache::NodeInfo *ni = &F->get();
// Do proper caching later.

Node *node = root_node->get_node(ni->path);
if (!node) {
ERR_PRINT("Failed to get cached path: " + String(ni->path) + ".");
Expand Down
4 changes: 4 additions & 0 deletions core/io/multiplayer_replicator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ Error MultiplayerReplicator::_encode_state(const List<Variant> &p_variants, uint
Error MultiplayerReplicator::_decode_state(const List<StringName> &p_properties, Object *p_obj, const uint8_t *p_buffer, int p_len, int &r_len, bool p_raw) {
r_len = 0;
int argc = p_properties.size();
if (argc == 0 && p_raw) {
ERR_FAIL_COND_V_MSG(p_len != 0, ERR_INVALID_DATA, "Buffer has trailing bytes.");
return OK;
}
ERR_FAIL_COND_V(p_raw && argc != 1, ERR_INVALID_DATA);
if (p_raw) {
r_len = p_len;
Expand Down

0 comments on commit 6ab1c1b

Please sign in to comment.