12345678910111213141516171819202122232425262728293031323334 |
- /*
- * Author: Patrick-Christopher Mattulat
- * Company: Lynar Studios
- * E-Mail: webmaster@lynarstudios.com
- * Created: 2023-02-08
- * Changed: 2023-02-08
- *
- * */
- #include <ls-std/core/evaluator/NullPointerEvaluator.hpp>
- #include <ls-std/core/exception/NullPointerException.hpp>
- ls::std::core::NullPointerEvaluator::NullPointerEvaluator(const ::std::shared_ptr<void> &_argument) : argument(_argument)
- {}
- ls::std::core::NullPointerEvaluator::NullPointerEvaluator(const ::std::shared_ptr<void> &_argument, ::std::string _message) : argument(_argument), message(::std::move(_message))
- {}
- ls::std::core::NullPointerEvaluator::~NullPointerEvaluator() = default;
- void ls::std::core::NullPointerEvaluator::evaluate()
- {
- if (this->argument == nullptr)
- {
- if (this->message.empty())
- {
- throw ls::std::core::NullPointerException{"reference in use is null!"};
- }
- else
- {
- throw ls::std::core::NullPointerException{this->message};
- }
- }
- }
|