Skip to content

Commit a7a60b1

Browse files
committed
Turn throw into assert in a can-not-happen situation
We should not try to instantiate this class if we don't have a file name.
1 parent d744f2f commit a7a60b1

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/node-persistent-cache.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#include "node-persistent-cache.hpp"
55
#include "options.hpp"
66

7+
#include <cassert>
8+
79
void node_persistent_cache::set(osmid_t id, osmium::Location location)
810
{
911
m_index->set(static_cast<osmium::unsigned_object_id_type>(id), location);
@@ -17,10 +19,7 @@ osmium::Location node_persistent_cache::get(osmid_t id) const noexcept
1719

1820
node_persistent_cache::node_persistent_cache(const options_t *options)
1921
{
20-
if (options->flat_node_file.empty()) {
21-
throw std::runtime_error{"Unable to set up persistent cache: the name "
22-
"of the flat node file was not set."};
23-
}
22+
assert(!options->flat_node_file.empty());
2423

2524
m_fname = options->flat_node_file.c_str();
2625
m_remove_file = options->droptemp;

0 commit comments

Comments
 (0)