Browse Source

LibIMAP: Use try_parse_number instead of parse_number when parsing parts

This makes it so we can use Optional instead of relying on an error
number.
Luke 4 years ago
parent
commit
e80f8746b1
1 changed files with 3 additions and 3 deletions
  1. 3 3
      Userland/Libraries/LibIMAP/Parser.cpp

+ 3 - 3
Userland/Libraries/LibIMAP/Parser.cpp

@@ -719,9 +719,9 @@ FetchCommand::DataItem Parser::parse_fetch_data_item()
             data_item.section->parts = Vector<unsigned>();
 
             while (!try_consume("]")) {
-                auto num = parse_number();
-                if (num != (unsigned)-1) {
-                    data_item.section->parts->append(num);
+                auto num = try_parse_number();
+                if (num.has_value()) {
+                    data_item.section->parts->append(num.value());
                     continue;
                 }
                 auto atom = parse_atom();