Commit 0a4121dd authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen
Browse files

Remove checks for nullptr callback

parent 3853d557
......@@ -259,8 +259,7 @@ std::shared_ptr<Media> MediaLibrary::addFile( const fs::IFile& fileFs, Folder& p
Media::destroy( this, mptr->id() );
return nullptr;
}
if ( m_callback != nullptr )
m_callback->onMediaAdded( mptr );
m_callback->onMediaAdded( mptr );
if ( m_parser != nullptr )
m_parser->parse( mptr, file );
return mptr;
......
......@@ -112,8 +112,7 @@ void DiscovererWorker::run()
}
if ( task.reload == false )
{
if ( m_cb != nullptr )
m_cb->onDiscoveryStarted( task.entryPoint );
m_cb->onDiscoveryStarted( task.entryPoint );
for ( auto& d : m_discoverers )
{
// Assume only one discoverer can handle an entrypoint.
......@@ -130,13 +129,11 @@ void DiscovererWorker::run()
if ( m_run == false )
break;
}
if ( m_cb != nullptr )
m_cb->onDiscoveryCompleted( task.entryPoint );
m_cb->onDiscoveryCompleted( task.entryPoint );
}
else
{
if ( m_cb != nullptr )
m_cb->onReloadStarted( task.entryPoint );
m_cb->onReloadStarted( task.entryPoint );
for ( auto& d : m_discoverers )
{
try
......@@ -153,8 +150,7 @@ void DiscovererWorker::run()
if ( m_run == false )
break;
}
if ( m_cb != nullptr )
m_cb->onReloadCompleted( task.entryPoint );
m_cb->onReloadCompleted( task.entryPoint );
}
}
LOG_INFO( "Exiting DiscovererWorker thread" );
......
......@@ -89,9 +89,6 @@ void Parser::restore()
void Parser::updateStats()
{
if ( m_callback == nullptr )
return;
auto percent = m_opToDo > 0 ? ( m_opDone * 100 / m_opToDo ) : 0;
if ( percent != m_percent )
{
......@@ -112,8 +109,7 @@ void Parser::done( std::unique_ptr<parser::Task> t, parser::Task::Status status
}
if ( status == parser::Task::Status::Success )
{
if ( m_callback != nullptr )
m_callback->onMediaUpdated( t->media );
m_callback->onMediaUpdated( t->media );
}
auto serviceIdx = ++t->currentService;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment