From 5192708bda86625a40ce67ff297dca8138f9cc13 Mon Sep 17 00:00:00 2001 From: hop311 Date: Sat, 20 Apr 2024 23:16:45 +0100 Subject: Pre-allocate and use std::move for Godot Arrays and Dictionaries --- extension/src/openvic-extension/utility/Utilities.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'extension/src/openvic-extension/utility') diff --git a/extension/src/openvic-extension/utility/Utilities.cpp b/extension/src/openvic-extension/utility/Utilities.cpp index 7450212..4389e95 100644 --- a/extension/src/openvic-extension/utility/Utilities.cpp +++ b/extension/src/openvic-extension/utility/Utilities.cpp @@ -80,7 +80,8 @@ static Ref load_dds_image(String const& path) { ); PackedByteArray pixels; - pixels.resize(size); + ERR_FAIL_COND_V(pixels.resize(size) != OK, nullptr); + /* Index offset used to control whether we are reading */ const size_t rb_idx = 2 * needs_bgr_to_rgb; uint8_t const* ptr = static_cast(texture.data()); -- cgit v1.2.3-56-ga3b1