diff options
| -rw-r--r-- | src/cppc4group.cpp | 5 | ||||
| -rw-r--r-- | src/cppc4group.hpp | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/cppc4group.cpp b/src/cppc4group.cpp index 950a714..409f2ef 100644 --- a/src/cppc4group.cpp +++ b/src/cppc4group.cpp @@ -22,7 +22,10 @@ struct CppC4Group::Private { Private() : g{cc4group.new_()} { - + if(g == nullptr) + { + throw std::bad_alloc(); + } } Private(CC4Group* g) : g{g} diff --git a/src/cppc4group.hpp b/src/cppc4group.hpp index c30af44..eb06585 100644 --- a/src/cppc4group.hpp +++ b/src/cppc4group.hpp @@ -101,6 +101,7 @@ public: public: // the constructor will automatically construct an internal CC4Group, so no new-equivalent method is needed + // may throw std::bad_alloc if the allocation and construction of the internal CC4Group object fails CppC4Group(); // the move constructor is needed to move the returned group out of the optional from openAsChild |
