aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-dataloader/ParseState.hpp
diff options
context:
space:
mode:
author Spartan322 <Megacake1234@gmail.com>2024-08-03 23:29:33 +0200
committer Spartan322 <Megacake1234@gmail.com>2024-08-03 23:29:33 +0200
commit2addc7763556ff76809f14e2063d1452aa9d6275 (patch)
tree996cac9cfa3c18798b5e509f51935a2538baac3f /src/openvic-dataloader/ParseState.hpp
parent2f6f6bdbb191aca01a1c4a9587e314442d219fb4 (diff)
Fix crash for empty/invalid/not-found filepaths
Add tests to validate empty string path Add tests to validate non-existent string path Add tests to validate nullptr buffer parser
Diffstat (limited to 'src/openvic-dataloader/ParseState.hpp')
-rw-r--r--src/openvic-dataloader/ParseState.hpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/openvic-dataloader/ParseState.hpp b/src/openvic-dataloader/ParseState.hpp
index 806829c..259f2a5 100644
--- a/src/openvic-dataloader/ParseState.hpp
+++ b/src/openvic-dataloader/ParseState.hpp
@@ -30,6 +30,8 @@ namespace ovdl {
using file_type = typename ast_type::file_type;
using diagnostic_logger_type = BasicDiagnosticLogger<ParseState>;
+ ParseState() : _ast {}, _logger { this->ast().file() } {}
+
ParseState(typename ast_type::file_type&& file, detail::Encoding encoding)
: _ast { std::move(file) },
_logger { this->ast().file() },
@@ -69,6 +71,8 @@ namespace ovdl {
using file_type = FileT;
using diagnostic_logger_type = BasicDiagnosticLogger<FileParseState>;
+ FileParseState() : _file {}, _logger { this->file() } {}
+
FileParseState(file_type&& file, detail::Encoding encoding)
: _file { std::move(file) },
_logger { this->file() },