From 40a77a87621817bd2b551563306262ee7ef8dde7 Mon Sep 17 00:00:00 2001 From: Jiri Pittner Date: Fri, 30 Oct 2026 21:27:02 +0100 Subject: [PATCH] bugfixes in laerror --- laerror.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/laerror.h b/laerror.h index b64c0fe..95c8459 100644 --- a/laerror.h +++ b/laerror.h @@ -18,6 +18,7 @@ #ifndef _LAERROR_H_ #define _LAERROR_H_ #include +#include #include @@ -36,8 +37,9 @@ extern bool _LA_count_check; //intentionally not const class LAerror : public std::exception { public: - const char *msg; - LAerror(const char *s) {msg=s;}; + std::string msg; //own copy: the argument may be a local buffer of an error handler + LAerror(const char *s) : msg(s?s:"unspecified") {}; + const char *what() const noexcept {return msg.c_str();}; }; #ifdef __GNUG__