From a11bccaa1269636281605814c095bae543905278 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 7 Nov 2013 21:42:51 +0000 Subject: [PATCH] fix Buffer constructor exception safety --- src/buffer.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/buffer.cc b/src/buffer.cc index 249064bb..1d9c9baa 100644 --- a/src/buffer.cc +++ b/src/buffer.cc @@ -14,7 +14,8 @@ namespace Kakoune Buffer::Buffer(String name, Flags flags, std::vector lines, time_t fs_timestamp) - : m_name(std::move(name)), m_flags(flags | Flags::NoUndo), + : m_name(flags & Flags::File ? real_path(parse_filename(name)) : std::move(name)), + m_flags(flags | Flags::NoUndo), m_history(), m_history_cursor(m_history.begin()), m_last_save_undo_index(0), m_timestamp(0), @@ -25,9 +26,6 @@ Buffer::Buffer(String name, Flags flags, std::vector lines, { BufferManager::instance().register_buffer(*this); - if (flags & Flags::File) - m_name = real_path(m_name); - if (lines.empty()) lines.emplace_back("\n");