Merge pull request #297 from dxx-rebirth/newdemo_no_space
Fix crash when ran out of disk space when writing demo
This commit is contained in:
commit
d10896f116
|
@ -317,13 +317,16 @@ static int _newdemo_write(const void *buffer, int elsize, int nelem )
|
|||
{
|
||||
int num_written, total_size;
|
||||
|
||||
if (unlikely(nd_record_v_no_space))
|
||||
return -1;
|
||||
|
||||
total_size = elsize * nelem;
|
||||
nd_record_v_framebytes_written += total_size;
|
||||
Newdemo_num_written += total_size;
|
||||
Assert(outfile);
|
||||
num_written = (PHYSFS_write)(outfile, buffer, elsize, nelem);
|
||||
|
||||
if (num_written == nelem && !nd_record_v_no_space)
|
||||
if (likely(num_written == nelem))
|
||||
return num_written;
|
||||
|
||||
nd_record_v_no_space=2;
|
||||
|
|
Loading…
Reference in a new issue