Skip to content

Commit

Permalink
fix(Vfs): re-order mount_disk code to prevent use of nullptr
Browse files Browse the repository at this point in the history
  • Loading branch information
lmichaelis committed Nov 4, 2023
1 parent d4dad43 commit a5cdce4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Vfs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ namespace zenkit {
void Vfs::mount_disk(phoenix::buffer buf, VfsOverwriteBehavior overwrite) {
auto mem = std::make_unique<std::byte[]>(buf.limit());
::memcpy(mem.get(), buf.array(), buf.limit());
_m_data.push_back(std::move(mem));
this->mount_disk(mem.get(), buf.limit(), overwrite);
_m_data.push_back(std::move(mem));
}

void Vfs::mount_disk(Read* buf, VfsOverwriteBehavior overwrite) {
Expand All @@ -282,8 +282,8 @@ namespace zenkit {
auto mem = std::make_unique<std::byte[]>(size);
buf->read(mem.get(), size);

_m_data.push_back(std::move(mem));
this->mount_disk(mem.get(), size, overwrite);
_m_data.push_back(std::move(mem));
}

VfsNode const& Vfs::root() const noexcept {
Expand Down

0 comments on commit a5cdce4

Please sign in to comment.