Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yaml-cpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
yaml-cpp
Commits
c9460110
Commit
c9460110
authored
Jan 20, 2020
by
Jesse Beder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix reading empty token stack with a node with properties but no scalar.
E.g. `!2`.
parent
3dca8668
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
src/singledocparser.cpp
+6
-0
test/integration/load_node_test.cpp
+5
-0
No files found.
src/singledocparser.cpp
View file @
c9460110
...
@@ -79,6 +79,12 @@ void SingleDocParser::HandleNode(EventHandler& eventHandler) {
...
@@ -79,6 +79,12 @@ void SingleDocParser::HandleNode(EventHandler& eventHandler) {
if
(
!
anchor_name
.
empty
())
if
(
!
anchor_name
.
empty
())
eventHandler
.
OnAnchor
(
mark
,
anchor_name
);
eventHandler
.
OnAnchor
(
mark
,
anchor_name
);
// after parsing properties, an empty node is again a possibility
if
(
m_scanner
.
empty
())
{
eventHandler
.
OnNull
(
mark
,
anchor
);
return
;
}
const
Token
&
token
=
m_scanner
.
peek
();
const
Token
&
token
=
m_scanner
.
peek
();
if
(
token
.
type
==
Token
::
PLAIN_SCALAR
&&
IsNullString
(
token
.
value
))
{
if
(
token
.
type
==
Token
::
PLAIN_SCALAR
&&
IsNullString
(
token
.
value
))
{
...
...
test/integration/load_node_test.cpp
View file @
c9460110
...
@@ -257,5 +257,10 @@ TEST(NodeTest, LoadTagWithParenthesis) {
...
@@ -257,5 +257,10 @@ TEST(NodeTest, LoadTagWithParenthesis) {
EXPECT_EQ
(
node
.
as
<
std
::
string
>
(),
"foo"
);
EXPECT_EQ
(
node
.
as
<
std
::
string
>
(),
"foo"
);
}
}
TEST
(
NodeTest
,
LoadTagWithNullScalar
)
{
Node
node
=
Load
(
"!2"
);
EXPECT_TRUE
(
node
.
IsNull
());
}
}
// namespace
}
// namespace
}
// namespace YAML
}
// namespace YAML
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment