diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2013-04-06 11:21:09 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2013-04-06 11:21:09 -0400 |
commit | 433e3bda70b251f9e43b9f539923faf21d8f0220 (patch) | |
tree | 997ef269215357ae0a0d0358a53bfea60596b3ab /libs | |
parent | c7f4a20e898e71f005139320f02703a8b68ac850 (diff) |
fix crash when using track templates caused by a recent change to the filescanner API. if the template contains no plugin states, the scanner would return a null pointer, and we would fail to notice
Diffstat (limited to 'libs')
-rw-r--r-- | libs/pbd/file_utils.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/libs/pbd/file_utils.cc b/libs/pbd/file_utils.cc index 7c3dffe71f..bb290fa6aa 100644 --- a/libs/pbd/file_utils.cc +++ b/libs/pbd/file_utils.cc @@ -18,6 +18,7 @@ */ #include <algorithm> +#include <vector> #include <glib.h> #include <glib/gstdio.h> @@ -32,6 +33,7 @@ #include "pbd/file_utils.h" #include "pbd/error.h" #include "pbd/pathscanner.h" +#include "pbd/stl_delete.h" #include "i18n.h" @@ -165,10 +167,14 @@ copy_files(const std::string & from_path, const std::string & to_dir) { PathScanner scanner; vector<string*>* files = scanner (from_path, accept_all_files, 0, true, false); - for (vector<string*>::iterator i = files->begin(); i != files->end(); ++i) { - std::string from = Glib::build_filename (from_path, **i); - std::string to = Glib::build_filename (to_dir, **i); - copy_file (from, to); + + if (files) { + for (vector<string*>::iterator i = files->begin(); i != files->end(); ++i) { + std::string from = Glib::build_filename (from_path, **i); + std::string to = Glib::build_filename (to_dir, **i); + copy_file (from, to); + } + vector_delete (files); } } |