mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
Avoid crash in call to magic_file() if the checked file does not exist
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40803 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d2f1b1a3df
commit
3929a71cd0
@ -375,6 +375,7 @@ string Formats::getFormatFromFile(FileName const & filename) const
|
||||
return string();
|
||||
|
||||
#ifdef HAVE_MAGIC_H
|
||||
if (filename.exists()) {
|
||||
magic_t magic_cookie = magic_open(MAGIC_MIME);
|
||||
if (magic_cookie) {
|
||||
string format;
|
||||
@ -402,6 +403,7 @@ string Formats::getFormatFromFile(FileName const & filename) const
|
||||
if (!format.empty())
|
||||
return format;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
string const format = guessFormatFromContents(filename);
|
||||
|
Loading…
Reference in New Issue
Block a user