Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid crash on gui when rendering from command line and no write access #3322

Merged
merged 1 commit into from Feb 4, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 19 additions & 8 deletions src/core/audio/AudioFileDevice.cpp
Expand Up @@ -27,6 +27,7 @@

#include "AudioFileDevice.h"
#include "ExportProjectDialog.h"
#include "GuiApplication.h"


AudioFileDevice::AudioFileDevice( const sample_rate_t _sample_rate,
Expand All @@ -50,17 +51,27 @@ AudioFileDevice::AudioFileDevice( const sample_rate_t _sample_rate,

if( m_outputFile.open( QFile::WriteOnly | QFile::Truncate ) == false )
{
QMessageBox::critical( NULL,
ExportProjectDialog::tr( "Could not open file" ),
ExportProjectDialog::tr( "Could not open file %1 "
QString title, message;
title = ExportProjectDialog::tr( "Could not open file" );
message = ExportProjectDialog::tr( "Could not open file %1 "
"for writing.\nPlease make "
"sure you have write-"
"sure you have write "
"permission to the file and "
"the directory containing the "
"file and try again!" ).arg(
_file ),
QMessageBox::Ok,
QMessageBox::NoButton );
"file and try again!"
).arg( _file );

if( gui )
{
QMessageBox::critical( NULL, title, message,
QMessageBox::Ok,
QMessageBox::NoButton );
}
else
{
fprintf( stderr, "%s\n", message.toUtf8().constData() );
exit( EXIT_FAILURE );
}
}
}

Expand Down