Skip to content

Commit

Permalink
booru/image: Don't save files that have no data
Browse files Browse the repository at this point in the history
I'm trying to figure out how some files are getting saved blank and this
seems like the best bet.
  • Loading branch information
ahodesuka committed Dec 3, 2017
1 parent ae9cb0c commit ceeaed6
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/booru/image.cc
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,15 @@ void Image::on_finished()
{
std::lock_guard<std::mutex> lock(m_DownloadMutex);

m_Curler.save_file(m_Path);
m_Curler.clear();
if (m_Curler.get_data_size() > 0)
{
m_Curler.save_file(m_Path);
m_Curler.clear();
}
else
{
std::cerr << "Booru::Image::on_finished: Curler recieved no data yet finished!" << std::endl;
}

if (m_Loader)
{
Expand All @@ -240,7 +247,7 @@ void Image::on_finished()
}

m_SignalPixbufChanged();
m_DownloadCond.notify_one();
m_DownloadCond.notify_all();
}

void Image::on_area_prepared()
Expand Down

0 comments on commit ceeaed6

Please sign in to comment.