fix a couple of segfaults

This commit is contained in:
Tim Felgentreff 2016-12-02 09:59:23 +01:00
parent 9ecf7918e3
commit a6eb7e9764
2 changed files with 8 additions and 1 deletions

View file

@ -165,10 +165,17 @@ int copy_file(const char* src_path, const struct stat* sb, int typeflag) {
mkdir_p(dst_path);
break;
case FTW_F:
mkdir_p(dst_path);
FILE* in = fopen(src_path, "rb");
FILE* out = fopen(dst_path, "wb");
char buf[4096];
int c = 0;
if (!in) {
error("Extraction error", "Could not open source folder for reading.");
}
if (!out) {
error("Extraction error", "Could not open data folder for writing.");
}
while (c = fread(buf, sizeof(char), 4096, in)) {
fwrite(buf, sizeof(char), c, out);
}

View file

@ -782,7 +782,7 @@ void Invalidate()
// Switch to the shader currently stored in Video.ShaderIndex without changing it
void SwitchToShader() {
#if defined(USE_OPENGL) || defined(USE_GLES)
if (UseOpenGL) {
if (TheScreen && UseOpenGL && GLShaderPipelineSupported) {
LoadShaders(0, NULL);
}
#endif