From aab8da25ad2c3e6d2df03abbc8e35c1725938c40 Mon Sep 17 00:00:00 2001 From: qarmin Date: Tue, 23 Jul 2019 09:14:31 +0200 Subject: Fix some code found by Coverity Scan and PVS Studio --- core/io/packet_peer.cpp | 5 +++-- core/io/resource_format_binary.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'core/io') diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp index c77c81f9e2..1e4ea715b3 100644 --- a/core/io/packet_peer.cpp +++ b/core/io/packet_peer.cpp @@ -110,10 +110,11 @@ Error PacketPeer::put_var(const Variant &p_packet, bool p_full_objects) { Variant PacketPeer::_bnd_get_var(bool p_allow_objects) { Variant var; - get_var(var, p_allow_objects); + Error err = get_var(var, p_allow_objects); + ERR_FAIL_COND_V(err != OK, Variant()); return var; -}; +} Error PacketPeer::_put_packet(const PoolVector &p_buffer) { return put_packet_buffer(p_buffer); diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 38bef2768e..146480e5a2 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -718,8 +718,8 @@ Error ResourceInteractiveLoaderBinary::poll() { Resource *r = Object::cast_to(obj); if (!r) { error = ERR_FILE_CORRUPT; - memdelete(obj); //bye ERR_EXPLAIN(local_path + ":Resource type in resource field not a resource, type is: " + obj->get_class()); + memdelete(obj); //bye ERR_FAIL_V(ERR_FILE_CORRUPT); } -- cgit v1.2.3