Fix a mistake that will return an invalid pointer
This commit is contained in:
parent
0994a86b2f
commit
29d886718c
@ -5,13 +5,15 @@
|
||||
class SystemError : public Exception {
|
||||
private:
|
||||
const std::error_code _ErrorCode;
|
||||
const std::string _ErrorString;
|
||||
public:
|
||||
SystemError(const char* FileName,
|
||||
int Line,
|
||||
unsigned long Code,
|
||||
const char* Message) noexcept :
|
||||
Exception(FileName, Line, Message),
|
||||
_ErrorCode(Code, std::system_category()) {}
|
||||
_ErrorCode(Code, std::system_category()),
|
||||
_ErrorString(_ErrorCode.message()) {}
|
||||
|
||||
virtual bool HasErrorCode() const noexcept override {
|
||||
return true;
|
||||
@ -22,7 +24,7 @@ public:
|
||||
}
|
||||
|
||||
virtual const char* ErrorString() const noexcept override {
|
||||
return _ErrorCode.message().c_str();
|
||||
return _ErrorString.c_str();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user