write command refuse to write a scratch file when no filename is given
This commit is contained in:
parent
207f2f6bb9
commit
8e0f99a03b
|
@ -271,6 +271,10 @@ void write_buffer(const CommandParameters& params, Context& context)
|
||||||
throw wrong_argument_count();
|
throw wrong_argument_count();
|
||||||
|
|
||||||
Buffer& buffer = context.window().buffer();
|
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()
|
String filename = params.empty() ? buffer.name()
|
||||||
: parse_filename(params[0]);
|
: parse_filename(params[0]);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user