Quote plugin caused crash if the file was empty. Fixed.

This commit is contained in:
Kimmo Pekkola 2009-07-27 20:06:07 +00:00
parent 1dbfc85b01
commit b5618bfb92

View File

@ -245,6 +245,8 @@ double Update2(UINT id)
fseek(file, 0, SEEK_END); fseek(file, 0, SEEK_END);
int size = ftell(file); int size = ftell(file);
if (size > 0)
{
// Go to a random place // Go to a random place
int pos = rand() % size; int pos = rand() % size;
fseek(file, (pos / 2) * 2, SEEK_SET); fseek(file, (pos / 2) * 2, SEEK_SET);
@ -394,6 +396,7 @@ double Update2(UINT id)
} }
while (sepPos2 == NULL); while (sepPos2 == NULL);
} }
}
fclose(file); fclose(file);
} }