From 55098c79a5b867170df31e908508a6f0eddbdc42 Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 14 Nov 2008 01:33:40 +0000 Subject: [PATCH] fix for multifile flush --- panda/src/express/multifile.cxx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/panda/src/express/multifile.cxx b/panda/src/express/multifile.cxx index 6b2f9b50e4..a21361c7f0 100644 --- a/panda/src/express/multifile.cxx +++ b/panda/src/express/multifile.cxx @@ -641,10 +641,17 @@ flush() { // All right, now write out each subfile's data. for (pi = _new_subfiles.begin(); pi != _new_subfiles.end(); ++pi) { Subfile *subfile = (*pi); - _read->acquire(); - _next_index = subfile->write_data(*_write, _read->get_istream(), - _next_index, this); - _read->release(); + + if (_read != (IStreamWrapper *)NULL) { + _read->acquire(); + _next_index = subfile->write_data(*_write, _read->get_istream(), + _next_index, this); + _read->release(); + + } else { + _next_index = subfile->write_data(*_write, NULL, _next_index, this); + } + nassertr(_next_index == _write->tellp(), false); _next_index = pad_to_streampos(_next_index); if (subfile->is_data_invalid()) {