mirror of https://github.com/mgba-emu/mgba.git
Qt: Fix some filename dialogs not checking for null return
This commit is contained in:
parent
e03b1486e4
commit
a5c627c090
|
@ -577,6 +577,9 @@ void FrameView::frameCallback(FrameView* viewer, std::shared_ptr<bool> lock) {
|
|||
void FrameView::exportFrame() {
|
||||
QString filename = GBAApp::app()->getSaveFileName(this, tr("Export frame"),
|
||||
tr("Portable Network Graphics (*.png)"));
|
||||
if (filename.isNull()) {
|
||||
return;
|
||||
}
|
||||
CoreController::Interrupter interrupter(m_controller);
|
||||
m_framebuffer.save(filename, "PNG");
|
||||
}
|
||||
|
|
|
@ -86,7 +86,9 @@ void GIFView::stopRecording() {
|
|||
|
||||
void GIFView::selectFile() {
|
||||
QString filename = GBAApp::app()->getSaveFileName(this, tr("Select output file"), tr("Graphics Interchange Format (*.gif);;WebP ( *.webp);;Animated Portable Network Graphics (*.png *.apng)"));
|
||||
m_ui.filename->setText(filename);
|
||||
if (!filename.isNull()) {
|
||||
m_ui.filename->setText(filename);
|
||||
}
|
||||
}
|
||||
|
||||
void GIFView::setFilename(const QString& filename) {
|
||||
|
|
|
@ -136,6 +136,9 @@ void PaletteView::exportPalette(int start, int length) {
|
|||
CoreController::Interrupter interrupter(m_controller);
|
||||
QString filename = GBAApp::app()->getSaveFileName(this, tr("Export palette"),
|
||||
tr("Windows PAL (*.pal);;Adobe Color Table (*.act)"));
|
||||
if (filename.isNull()) {
|
||||
return;
|
||||
}
|
||||
VFile* vf = VFileDevice::open(filename, O_WRONLY | O_CREAT | O_TRUNC);
|
||||
if (!vf) {
|
||||
LOG(QT, ERROR) << tr("Failed to open output palette file: %1").arg(filename);
|
||||
|
|
Loading…
Reference in New Issue