diff --git a/src/filesystem.cpp b/src/filesystem.cpp index 46a8acc..b4e3f23 100644 --- a/src/filesystem.cpp +++ b/src/filesystem.cpp @@ -51,8 +51,9 @@ struct SDLRWIoContext{ : ops(SDL_IOFromFile(filename, "r")), filename(filename) { - if (!ops) + if (!ops){ crash(Exception::SDLError, "Failed to open file: %s", SDL_GetError()); + } } ~SDLRWIoContext(){ @@ -594,17 +595,20 @@ void FileSystem::openRead(OpenHandler &handler, const char *filename){ PHYSFS_enumerate(dir, openReadEnumCB, &data); } - if (data.physfsError) + if (data.physfsError){ crash(Exception::PHYSFSError, "PhysFS: %s", data.physfsError); + } - if (data.matchCount == 0) + if (data.matchCount == 0){ crash(Exception::NoFileError, "%s", filename); + } } void FileSystem::openReadRaw(SDL_IOStream* &stream, const char *filename){ PHYSFS_File *handle = PHYSFS_openRead(filename); - if (!handle) + if (!handle){ crash(Exception::NoFileError, "%s", filename); + } initReadOps(handle, stream); } diff --git a/src/vorbissource.cpp b/src/vorbissource.cpp index 59af03b..ae4cf03 100644 --- a/src/vorbissource.cpp +++ b/src/vorbissource.cpp @@ -80,7 +80,7 @@ struct VorbisSource : ALDataSource{ if (error){ SDL_CloseIO(&src); - crash("Vorbisfile: Cannot read ogg file", Exception::MKXPError, true); + crash(Exception::MKXPError, "Vorbisfile: Cannot read ogg file"); } /* Extract bitstream info */ @@ -90,7 +90,7 @@ struct VorbisSource : ALDataSource{ if (info.channels > 2){ ov_clear(&vf); SDL_CloseIO(&src); - crash("Cannot handle audio with more than 2 channels", Exception::MKXPError, true); + crash(Exception::MKXPError, "Cannot handle audio with more than 2 channels"); } info.alFormat = chooseALFormat(sizeof(int16_t), info.channels);