Prevent libXML read error in case file does not exist

This commit is contained in:
Robin Gareus 2021-04-19 04:55:17 +02:00
parent 71788ecfe4
commit 905ea49f05
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
1 changed files with 2 additions and 2 deletions

View File

@ -16,7 +16,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <glib.h>
#include <glibmm.h>
#include "pbd/gstdio_compat.h"
#include <glibmm/miscutils.h>
@ -131,7 +131,7 @@ ALoudnessPresets::ALoudnessPresets (bool built_in_only)
}
std::string fn = Glib::build_filename (ARDOUR::user_config_directory (), "loudness-presets");
XMLTree tree;
if (tree.read (fn)) {
if (Glib::file_test (fn, Glib::FILE_TEST_EXISTS) && tree.read (fn)) {
XMLNodeList nlist = tree.root()->children();
XMLNodeConstIterator i;
for (i = nlist.begin(); i != nlist.end(); ++i) {