summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-07-23 15:08:44 +0200
committerGitHub <noreply@github.com>2019-07-23 15:08:44 +0200
commit4c943cca2c6d6cd7a197cb1601a6356e65254837 (patch)
tree0f906f50ff2013f20a274ea6c746c6574a15e1f2 /core
parentc7a427241e7f4dd6ab9ac89f51d3bb9f6632008b (diff)
parentaab8da25ad2c3e6d2df03abbc8e35c1725938c40 (diff)
Merge pull request #30716 from qarmin/fixed_static_analiser_code
Fix some code found by Coverity Scan and PVS Studio
Diffstat (limited to 'core')
-rw-r--r--core/class_db.cpp1
-rw-r--r--core/io/packet_peer.cpp5
-rw-r--r--core/io/resource_format_binary.cpp2
-rw-r--r--core/make_binders.py3
4 files changed, 5 insertions, 6 deletions
diff --git a/core/class_db.cpp b/core/class_db.cpp
index 794d990083..49e3f94d8f 100644
--- a/core/class_db.cpp
+++ b/core/class_db.cpp
@@ -480,6 +480,7 @@ uint64_t ClassDB::get_api_hash(APIType p_api) {
for (List<StringName>::Element *F = snames.front(); F; F = F->next()) {
PropertySetGet *psg = t->property_setget.getptr(F->get());
+ ERR_FAIL_COND_V(!psg, 0);
hash = hash_djb2_one_64(F->get().hash(), hash);
hash = hash_djb2_one_64(psg->setter.hash(), hash);
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<uint8_t> &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<Resource>(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);
}
diff --git a/core/make_binders.py b/core/make_binders.py
index 24901c42a1..c38db5cef4 100644
--- a/core/make_binders.py
+++ b/core/make_binders.py
@@ -334,9 +334,6 @@ def make_version(template, nargs, argmax, const, ret):
elif (cmd == "noarg"):
for i in range(nargs + 1, argmax + 1):
outtext += data.replace("@", str(i))
- elif (cmd == "noarg"):
- for i in range(nargs + 1, argmax + 1):
- outtext += data.replace("@", str(i))
from_pos = end + 1