diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-06-25 22:31:50 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-06-25 23:31:02 +0300 |
commit | 7ee1d89a656c05b62fa3104b59504afed0037b69 (patch) | |
tree | 7a20e371ba1035fc43135f069407b51d81d15527 /src/utils/physfsrwops.cpp | |
parent | d49a520d19f28c613c68b574686b182a9c0621be (diff) | |
download | mv-7ee1d89a656c05b62fa3104b59504afed0037b69.tar.gz mv-7ee1d89a656c05b62fa3104b59504afed0037b69.tar.bz2 mv-7ee1d89a656c05b62fa3104b59504afed0037b69.tar.xz mv-7ee1d89a656c05b62fa3104b59504afed0037b69.zip |
Add missing checks into db directory.
Diffstat (limited to 'src/utils/physfsrwops.cpp')
-rw-r--r-- | src/utils/physfsrwops.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/utils/physfsrwops.cpp b/src/utils/physfsrwops.cpp index 10799b824..bc78d09cb 100644 --- a/src/utils/physfsrwops.cpp +++ b/src/utils/physfsrwops.cpp @@ -46,6 +46,8 @@ static int openedRWops = 0; static PHYSFSINT physfsrwops_seek(SDL_RWops *const rw, const PHYSFSINT offset, const int whence) { + if (!rw) + return -1; PHYSFS_file *const handle = static_cast<PHYSFS_file *const>( rw->hidden.unknown.data1); PHYSFSINT pos = 0; @@ -115,10 +117,13 @@ static PHYSFSINT physfsrwops_seek(SDL_RWops *const rw, const PHYSFSINT offset, return pos; } /* physfsrwops_seek */ -static PHYSFSSIZE physfsrwops_read(SDL_RWops *const rw, void *ptr, +static PHYSFSSIZE physfsrwops_read(SDL_RWops *const rw, + void *ptr, const PHYSFSSIZE size, const PHYSFSSIZE maxnum) { + if (!rw) + return 0; PHYSFS_file *const handle = static_cast<PHYSFS_file *const>( rw->hidden.unknown.data1); const PHYSFS_sint64 rc = PHYSFS_read(handle, ptr, @@ -137,6 +142,8 @@ static PHYSFSSIZE physfsrwops_write(SDL_RWops *const rw, const void *ptr, const PHYSFSSIZE size, const PHYSFSSIZE num) { + if (!rw) + return 0; PHYSFS_file *const handle = static_cast<PHYSFS_file *const>( rw->hidden.unknown.data1); const PHYSFS_sint64 rc = PHYSFS_write(handle, ptr, @@ -150,6 +157,8 @@ static PHYSFSSIZE physfsrwops_write(SDL_RWops *const rw, const void *ptr, static int physfsrwops_close(SDL_RWops *const rw) { + if (!rw) + return 0; PHYSFS_file *const handle = static_cast<PHYSFS_file*>( rw->hidden.unknown.data1); if (!PHYSFS_close(handle)) |