summaryrefslogtreecommitdiff
path: root/libs/ardour/find_session.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-05-06 18:31:18 +0200
committerRobin Gareus <robin@gareus.org>2017-05-06 18:31:18 +0200
commit1f80f059be5dae1fdda2387f5d297f17f4ab8fe4 (patch)
treec5827fc500e74775ca69248dcb93e189cc9a4f19 /libs/ardour/find_session.cc
parent26decc032c1415fcf631dd7662f22024b4c9a8cf (diff)
Fix opening session-archives
Diffstat (limited to 'libs/ardour/find_session.cc')
-rw-r--r--libs/ardour/find_session.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/libs/ardour/find_session.cc b/libs/ardour/find_session.cc
index 3301dfd20d..05f88d83b3 100644
--- a/libs/ardour/find_session.cc
+++ b/libs/ardour/find_session.cc
@@ -215,9 +215,16 @@ inflate_session (const std::string& zipfile, const std::string& target_dir, stri
error << _("Archive does not contain a session folder") << endmsg;
return 3;
}
- if (bn[bn.length() - 1] == '/') {
- bn = bn.substr (0, bn.length() - 1);
+
+ size_t sep = bn.find_first_of ('/');
+
+ if (sep == string::npos) {
+ error << _("Archive does not contain a session folder") << endmsg;
+ return 3;
}
+
+ bn = bn.substr (0, sep);
+
if (bn.empty ()) {
error << _("Archive does not contain a valid session structure") << endmsg;
return 4;