From afbaabed02384471c1af803a3a74830a0bd56b5d Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Tue, 4 Aug 2009 12:11:30 +0200 Subject: [PATCH] SampleBuffer: do not show messagebox if there's no GUI Showing a messagebox if LMMS is running in console-mode only is bad and makes it crash. Therefore check for engine::hasGUI() first. --- src/core/sample_buffer.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/core/sample_buffer.cpp b/src/core/sample_buffer.cpp index 065ad846f..7f935a543 100644 --- a/src/core/sample_buffer.cpp +++ b/src/core/sample_buffer.cpp @@ -277,14 +277,17 @@ void sampleBuffer::update( bool _keep_settings ) // TODO: this list probably shouldn't be hardcoded QString decoders = niceListOfExts(); - QMessageBox::information( NULL, - QObject::tr( "Unrecognized audio format" ), - QObject::tr( "None of the available audio decoders " - "recognized the format you are trying to load. Try " - "converting the file to a format LMMS understands.\n\n" - "Your file: %1\n" - "Available decoders: %2\n").arg( file, decoders ), - QMessageBox::Ok | QMessageBox::Default ); + if( engine::hasGUI() ) + { + QMessageBox::information( NULL, + QObject::tr( "Unrecognized audio format" ), + QObject::tr( "None of the available audio decoders " + "recognized the format you are trying to load. Try " + "converting the file to a format LMMS understands.\n\n" + "Your file: %1\n" + "Available decoders: %2\n").arg( file, decoders ), + QMessageBox::Ok | QMessageBox::Default ); + } } }