diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-03-16 23:16:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-16 23:16:36 +0100 |
commit | bc7e105821cc1a7b1173bc997aa61b3f5b58430a (patch) | |
tree | 95fbebd9a69d61285ae767c0b51905c9c48dbf5b /drivers/unix/file_access_unix.cpp | |
parent | 97ce8708e86b4cf17b01f7f8ddfd74e348fbb56c (diff) | |
parent | c28428fe4dcd78886b972afcad6b239a58b4b973 (diff) |
Merge pull request #47079 from W4RH4WK/allow-nullptr-with-zero-length-get-buffer
Allow nullptr with zero length in FileAccess get_buffer
Diffstat (limited to 'drivers/unix/file_access_unix.cpp')
-rw-r--r-- | drivers/unix/file_access_unix.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/unix/file_access_unix.cpp b/drivers/unix/file_access_unix.cpp index 31ec9d4c93..4c08380dd0 100644 --- a/drivers/unix/file_access_unix.cpp +++ b/drivers/unix/file_access_unix.cpp @@ -240,7 +240,7 @@ uint8_t FileAccessUnix::get_8() const { } int FileAccessUnix::get_buffer(uint8_t *p_dst, int p_length) const { - ERR_FAIL_COND_V(!p_dst, -1); + ERR_FAIL_COND_V(!p_dst && p_length > 0, -1); ERR_FAIL_COND_V(p_length < 0, -1); ERR_FAIL_COND_V_MSG(!f, -1, "File must be opened before use."); int read = fread(p_dst, 1, p_length, f); |