diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2012-08-07 23:20:53 +0200 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2012-08-07 23:20:53 +0200 |
| commit | 8e0f99a03b0704b95c98b92deeb8041eb9703933 (patch) | |
| tree | eaf790e2779fba0182c5e16d07de708bdebe360c /src | |
| parent | 207f2f6bb9cbf65b9db61b766fc7a39d8c2d38d3 (diff) | |
write command refuse to write a scratch file when no filename is given
Diffstat (limited to 'src')
| -rw-r--r-- | src/commands.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/commands.cc b/src/commands.cc index 44e754ed..5b0f4b4c 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -271,6 +271,10 @@ void write_buffer(const CommandParameters& params, Context& context) throw wrong_argument_count(); Buffer& buffer = context.window().buffer(); + + if (params.empty() and buffer.type() == Buffer::Type::Scratch) + throw runtime_error("cannot write scratch buffer without a filename"); + String filename = params.empty() ? buffer.name() : parse_filename(params[0]); |
