mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 12:57:34 +00:00
AK: Make HashMap::get(Key) return an Optional<Value>.
This allows HashMap::get() to be used for value types that cannot be default constructed (e.g NonnullOwnPtr.)
This commit is contained in:
parent
e2798d6208
commit
1d0b464618
10 changed files with 27 additions and 17 deletions
|
@ -10,7 +10,7 @@ bool CArgsParserResult::is_present(const String& arg_name) const
|
|||
|
||||
String CArgsParserResult::get(const String& arg_name) const
|
||||
{
|
||||
return m_args.get(arg_name);
|
||||
return m_args.get(arg_name).value_or({});
|
||||
}
|
||||
|
||||
const Vector<String>& CArgsParserResult::get_single_values() const
|
||||
|
|
|
@ -92,7 +92,7 @@ void CHttpJob::on_socket_connected()
|
|||
buffer.append(payload.pointer(), payload.size());
|
||||
|
||||
bool ok;
|
||||
if (buffer.size() >= m_headers.get("Content-Length").to_int(ok) && ok) {
|
||||
if (buffer.size() >= m_headers.get("Content-Length").value_or("0").to_int(ok) && ok) {
|
||||
m_state = State::Finished;
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue