Skip to content

Commit

Permalink
Correctly initialize std::optional value
Browse files Browse the repository at this point in the history
  • Loading branch information
GAMMACASE committed Jun 2, 2024
1 parent 8dcbeb2 commit be95d04
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/os.linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ std::expected<VmBasicInfo, OsError> vm_query(uint8_t* address) {
&inode, path);

if (last_end < start && addr >= last_end && addr < start) {
info.emplace();
info->address = reinterpret_cast<uint8_t*>(last_end);
info->size = start - last_end;
info->access = VmAccess();
Expand All @@ -128,6 +129,7 @@ std::expected<VmBasicInfo, OsError> vm_query(uint8_t* address) {
last_end = end;

if (addr >= start && addr < end) {
info.emplace();
info->address = reinterpret_cast<uint8_t*>(start);
info->size = end - start,
info->access = VmAccess();
Expand Down

0 comments on commit be95d04

Please sign in to comment.