diff --git a/src/wavefile.c b/src/wavefile.c index 34e7375..ef1e4b2 100644 --- a/src/wavefile.c +++ b/src/wavefile.c @@ -1,3 +1,10 @@ +/** + * Copyright (c) 2017 rnlf + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the MIT license. See LICENSE for details. + */ + #include #include "filesystem.h" #include "wavefile.h" @@ -33,6 +40,11 @@ char const* wavefile_load(source_t *source, char const *filename) { char const *err = 0; uint8_t *waveData = filesystem_read(filename, &fileSize); + if(waveData == NULL) { + err = "Could not read WAV file"; + goto fail; + } + waveheader_t const* header = (waveheader_t const*)waveData; if(header->chunkId != RIFF_CHUNK_ID diff --git a/src/wavefile.h b/src/wavefile.h index e8db8d5..f462a27 100644 --- a/src/wavefile.h +++ b/src/wavefile.h @@ -1,5 +1,15 @@ -#pragma once +/** + * Copyright (c) 2017 rnlf + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the MIT license. See LICENSE for details. + */ + +#ifndef WAVEFILE_H +#define WAVEFILE_H #include "source.h" char const* wavefile_load(source_t *source, char const *filename); + +#endif