mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-17 12:16:30 +01:00
do not crash when considering a directory called midi (with any case) as an apparent MIDI file
This commit is contained in:
parent
b8e4c44637
commit
dc4bb5b758
1 changed files with 9 additions and 1 deletions
|
|
@ -32,6 +32,7 @@
|
||||||
|
|
||||||
#include <glib/gstdio.h>
|
#include <glib/gstdio.h>
|
||||||
#include <glibmm/miscutils.h>
|
#include <glibmm/miscutils.h>
|
||||||
|
#include <glibmm/fileutils.h>
|
||||||
|
|
||||||
#include "evoral/Control.hpp"
|
#include "evoral/Control.hpp"
|
||||||
|
|
||||||
|
|
@ -464,7 +465,14 @@ SMFSource::safe_midi_file_extension (const string& file)
|
||||||
const int nmatches = 2;
|
const int nmatches = 2;
|
||||||
regmatch_t matches[nmatches];
|
regmatch_t matches[nmatches];
|
||||||
|
|
||||||
if (compile && regcomp (&compiled_pattern, "[mM][iI][dD][iI]?$", REG_EXTENDED)) {
|
if (Glib::file_test (file, Glib::FILE_TEST_EXISTS)) {
|
||||||
|
if (!Glib::file_test (file, Glib::FILE_TEST_IS_REGULAR)) {
|
||||||
|
/* exists but is not a regular file */
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (compile && regcomp (&compiled_pattern, "\\.[mM][iI][dD][iI]?$", REG_EXTENDED)) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
compile = false;
|
compile = false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue