summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2016-05-24 22:36:20 +0100
committerMaxime Coste <frrrwww@gmail.com>2016-05-24 22:36:20 +0100
commit5cab2078f85aeca5e734ea08eb4285ed21b8227a (patch)
tree129456c85d3425b1c415b9493d2ddba37b0809e8 /src
parentfa35330b42ed3be06f2eda35f08b21233163b047 (diff)
Fix string view created from a temporary string
This is clearly a case where rust style lifetime analysis would have been nice, hopefully it comes with GSL lifetime extensions... Fixes #680
Diffstat (limited to 'src')
-rw-r--r--src/commands.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/commands.cc b/src/commands.cc
index 56a94430..8f552170 100644
--- a/src/commands.cc
+++ b/src/commands.cc
@@ -1871,8 +1871,7 @@ const CommandDesc change_working_directory_cmd = {
}},
[](const ParametersParser& parser, Context&, const ShellContext&)
{
-
- StringView target = parser.positional_count() == 1 ? parser[0] : "~";
+ StringView target = parser.positional_count() == 1 ? StringView{parser[0]} : "~";
if (chdir(parse_filename(target).c_str()) != 0)
throw runtime_error(format("cannot change to directory '{}'", target));
for (auto& buffer : BufferManager::instance())