summaryrefslogtreecommitdiff
path: root/core/io
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-11-17 11:57:23 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-11-17 11:57:23 +0100
commit8e00e71d35edaeb91d0d2957ed038763275fc069 (patch)
treee07888563f7ce551c5215441729509d08fd374fb /core/io
parent424a16d108104b5f1c1c08ff57e3476ff4aaae2d (diff)
parent5194c8af7c725b753c5ec5f25f2d42f27e0f78d3 (diff)
Merge pull request #67619 from nongvantinh/fix-calling-pckpacker-crash
Fixes engine crashes caused by the user failing to initialize PCKPacker with pck_start()
Diffstat (limited to 'core/io')
-rw-r--r--core/io/pck_packer.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/core/io/pck_packer.cpp b/core/io/pck_packer.cpp
index aa1b323db2..0118b4c6af 100644
--- a/core/io/pck_packer.cpp
+++ b/core/io/pck_packer.cpp
@@ -107,6 +107,8 @@ Error PCKPacker::pck_start(const String &p_file, int p_alignment, const String &
}
Error PCKPacker::add_file(const String &p_file, const String &p_src, bool p_encrypt) {
+ ERR_FAIL_COND_V_MSG(file.is_null(), ERR_INVALID_PARAMETER, "File must be opened before use.");
+
Ref<FileAccess> f = FileAccess::open(p_src, FileAccess::READ);
if (f.is_null()) {
return ERR_FILE_CANT_OPEN;