Use early return

This commit is contained in:
Blue 2025-12-03 12:58:34 -08:00
parent f8e2119aa6
commit c69c83b0ab

View File

@ -118,8 +118,13 @@ WSLASession::~WSLASession()
void WSLASession::ConfigureStorage(const WSLA_SESSION_SETTINGS& Settings)
{
if (Settings.StoragePath != nullptr)
if (Settings.StoragePath == nullptr)
{
// If no storage path is specified, use a tmpfs for convenience.
m_virtualMachine->Mount("", "/root", "tmpfs", "", 0);
return;
}
std::filesystem::path storagePath{Settings.StoragePath};
THROW_HR_IF_MSG(E_INVALIDARG, !storagePath.is_absolute(), "Storage path is not absolute: %ls", storagePath.c_str());
@ -174,12 +179,6 @@ void WSLASession::ConfigureStorage(const WSLA_SESSION_SETTINGS& Settings)
m_virtualMachine->Mount(diskDevice.c_str(), "/root", "ext4", "", 0);
deleteVhdOnFailure.release();
}
else
{
// If no storage path is specified, use a tmpfs for convenience.
m_virtualMachine->Mount("", "/root", "tmpfs", "", 0);
}
}
HRESULT WSLASession::GetDisplayName(LPWSTR* DisplayName)