diff --git a/src/branches.cpp b/src/branches.cpp index 99a0eaf8..c8765d29 100644 --- a/src/branches.cpp +++ b/src/branches.cpp @@ -205,6 +205,9 @@ namespace l Branches::Impl tmp_branches(branches_->minfreespace()); str::split(str_,':',&paths); + if (paths.empty()) + return -ENOTSUP; + for(auto &path : paths) { rv = l::parse(path,&tmp_branches); @@ -269,6 +272,9 @@ namespace l int erase_begin(Branches::Impl *branches_) { + if (branches_->size() <= 1) + return -ENOTSUP; + branches_->erase(branches_->begin()); return 0; @@ -278,6 +284,9 @@ namespace l int erase_end(Branches::Impl *branches_) { + if (branches_->size() <= 1) + return -ENOTSUP; + branches_->pop_back(); return 0; @@ -299,6 +308,8 @@ namespace l { match = ::fnmatch(pi->c_str(),i->path.c_str(),0); } + if (match == 0 && branches_->size() == 1) + return -ENOTSUP; i = ((match == 0) ? branches_->erase(i) : (i+1)); }