1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:57:44 +00:00

AK: Remove Optional::operator bool()

This was causing some obvious-in-hindsight but hard to spot bugs where
we'd implicitly convert the bool to an integer type and carry on with
the number 1 instead of the actual value().
This commit is contained in:
Andreas Kling 2020-03-06 10:26:05 +01:00
parent ae233c1e82
commit 8bb361889c
6 changed files with 9 additions and 12 deletions

View file

@ -165,14 +165,14 @@ public:
if (!first_index.has_value())
return {};
size_t free_region_start = first_index;
size_t free_region_start = first_index.value();
size_t free_region_size = 1;
size_t max_region_start = free_region_start;
size_t max_region_size = free_region_size;
// Let's try and find the best fit possible
for (size_t j = first_index + 1; j < m_size && free_region_size < max_length; j++) {
for (size_t j = first_index.value() + 1; j < m_size && free_region_size < max_length; j++) {
if (!get(j)) {
if (free_region_size == 0)
free_region_start = j;