GUI: fix possible division by 0

This commit is contained in:
zvon 2020-04-13 20:41:38 +02:00
parent 2206f28124
commit 86fedf623c

View File

@ -507,6 +507,14 @@ void addToDB( const string &show, const string &path, const string &language,
ProgressBar p( progress_ptr );
#endif
if( seasons.size() == 0 ) {
#ifdef GUI
// hide progress window
p.print( 100 );
#endif
return;
}
p.print( _( RENAMING ) );
p.print( 0 );
@ -606,6 +614,14 @@ void refreshDB( bool linux, void *progress_ptr ) {
ProgressBar p( progress_ptr );
#endif // GUI
if( shows.size() == 0 ) {
#ifdef GUI
// hide progress window
p.print(100);
#endif
return;
}
for ( auto &show : shows ) {
if ( FSLib::exists( show[TEXT( "PATH" )] ) ) {
#ifndef GUI
@ -689,7 +705,17 @@ void updateDB( bool linux, void *progress_ptr ) {
#else // GUI
ProgressBar p( progress_ptr );
#endif
if( shows.size() == 0 ) {
#ifdef GUI
// hide progress window
p.print( 100 );
#endif
return;
}
p.print( _( UPDATING_DB ) );
#ifndef GUI
cout << std::endl << std::endl;
#endif
@ -784,6 +810,15 @@ void cleanDB( void *progress_ptr ) {
#else // GUI
ProgressBar p( progress_ptr );
#endif // GUI
if( shows.size() == 0 ) {
#ifdef GUI
// hide progress window
p.print( 100 );
#endif
return;
}
p.print( _( CLEANING_DB ) );
p.print( 0 );
int percent = 0;