check for file existence before asking libxml to load a file

This commit is contained in:
Paul Davis
2025-08-01 18:35:08 -06:00
parent 96431aa0d6
commit a1fdac58e6

View File

@@ -16,6 +16,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <glibmm/fileutils.h>
#include "pbd/types_convert.h"
#include "pbd/error.h"
#include "pbd/xml++.h"
@@ -151,6 +153,10 @@ RegionUISettingsManager::load (std::string const & xmlpath)
clear ();
if (!Glib::file_test (xmlpath, Glib::FILE_TEST_EXISTS)) {
return -1;
}
if (!state_tree.read (xmlpath)) {
std::cerr << "bad xmlpath " << xmlpath << std::endl;
return -1;