Skip to content

Commit

Permalink
Rearrange checks to work better for files that don't have a file size…
Browse files Browse the repository at this point in the history
… (ex:/proc/{pid}/mem)
  • Loading branch information
MinusGix committed Oct 24, 2019
1 parent 34d9611 commit b1f245f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/herix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,14 @@ size_t Herix::getFileSize () const {
size_t Herix::getFileEnd () const {
size_t file_size = getFileSize();

if (file_size <= start_position) {
return 0;
} else if (end_position.has_value()) {
if (end_position.has_value()) {
if (end_position.value() < start_position) {
return 0;
} else {
return end_position.value() - start_position;
}
} else if (file_size <= start_position) {
return 0;
} else {
return getFileSize() - start_position;
}
Expand Down

0 comments on commit b1f245f

Please sign in to comment.