Skip to content

Commit

Permalink
Check non-null resources
Browse files Browse the repository at this point in the history
  • Loading branch information
mhekkel committed May 5, 2023
1 parent 2eae136 commit 4979e83
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib-http/src/controller-rsrc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ class rsrc

rsrc(std::filesystem::path path);

std::string name() const { return rsrc_data::instance().name(m_impl->m_name); }
std::string name() const { return m_impl ? rsrc_data::instance().name(m_impl->m_name) : ""; }

const char *data() const { return rsrc_data::instance().data(m_impl->m_data); }
const char *data() const { return m_impl ? rsrc_data::instance().data(m_impl->m_data) : nullptr; }

unsigned long size() const { return m_impl->m_size; }
unsigned long size() const { return m_impl ? m_impl->m_size : 0; }

explicit operator bool() const { return m_impl != NULL and m_impl->m_size > 0; }

Expand Down

0 comments on commit 4979e83

Please sign in to comment.