diff --git a/include/crow/multipart.h b/include/crow/multipart.h index a05ffd3e3..f7b6c24dd 100644 --- a/include/crow/multipart.h +++ b/include/crow/multipart.h @@ -85,7 +85,11 @@ namespace crow part get_part_by_name(const std::string& name) { - return part_map.find(name)->second; + mp_map::iterator result = part_map.find(name); + if (result != part_map.end()) + return result->second; + else + return {}; } /// Represent all parts as a string (**does not include message headers**)