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