diff options
| author | Rodrigo Locatti <reinuseslisp@airmail.cc> | 2020-09-22 23:37:51 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-22 23:37:51 +0000 |
| commit | 43a7e8a2ebf95a024463e165bb867cb4a8750101 (patch) | |
| tree | 288ff1cc4677d6511ed8cc7e1b0db20ce2d2590f /src/core/file_sys/vfs_offset.cpp | |
| parent | f3b0c1b4b54c132ee24783c35db6bf4c6264622b (diff) | |
| parent | e457001dced3b86c89e842270c6ed0513e81027f (diff) | |
Merge pull request #4698 from lioncash/optional-null
General: Make use of std::nullopt where applicable
Diffstat (limited to 'src/core/file_sys/vfs_offset.cpp')
| -rw-r--r-- | src/core/file_sys/vfs_offset.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/file_sys/vfs_offset.cpp b/src/core/file_sys/vfs_offset.cpp index c96f884888..7714d3de55 100644 --- a/src/core/file_sys/vfs_offset.cpp +++ b/src/core/file_sys/vfs_offset.cpp @@ -58,10 +58,11 @@ std::size_t OffsetVfsFile::Write(const u8* data, std::size_t length, std::size_t } std::optional<u8> OffsetVfsFile::ReadByte(std::size_t r_offset) const { - if (r_offset < size) - return file->ReadByte(offset + r_offset); + if (r_offset >= size) { + return std::nullopt; + } - return {}; + return file->ReadByte(offset + r_offset); } std::vector<u8> OffsetVfsFile::ReadBytes(std::size_t r_size, std::size_t r_offset) const { |
