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
|
@ -32,6 +32,7 @@
|
|||
|
||||
#include <glib/gstdio.h>
|
||||
#include <glibmm/miscutils.h>
|
||||
#include <glibmm/fileutils.h>
|
||||
|
||||
#include "evoral/Control.hpp"
|
||||
|
||||
|
@ -464,7 +465,14 @@ SMFSource::safe_midi_file_extension (const string& file)
|
|||
const int nmatches = 2;
|
||||
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;
|
||||
} else {
|
||||
compile = false;
|
||||
|
|
Loading…
Reference in New Issue
Block a user