Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
yaml-cpp
Commits
812a2dc6
Commit
812a2dc6
authored
Dec 20, 2011
by
Jesse Beder
Browse files
Fixed assignment with an empty node (new API) - a segfault that only showed up in debuggable
parent
add46094
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
include/yaml-cpp/node/impl.h
include/yaml-cpp/node/impl.h
+3
-1
test/new-api/nodetests.cpp
test/new-api/nodetests.cpp
+8
-0
No files found.
include/yaml-cpp/node/impl.h
View file @
812a2dc6
...
...
@@ -100,7 +100,9 @@ namespace YAML
// assignment
inline
bool
Node
::
is
(
const
Node
&
rhs
)
const
{
return
m_pNode
?
m_pNode
->
is
(
*
rhs
.
m_pNode
)
:
false
;
if
(
!
m_pNode
||
!
rhs
.
m_pNode
)
return
false
;
return
m_pNode
->
is
(
*
rhs
.
m_pNode
);
}
template
<
typename
T
>
...
...
test/new-api/nodetests.cpp
View file @
812a2dc6
...
...
@@ -279,6 +279,13 @@ namespace Test
YAML_ASSERT
(
!!
node
[
"foo"
]);
return
true
;
}
TEST
Reassign
()
{
YAML
::
Node
node
=
YAML
::
Load
(
"foo"
);
node
=
YAML
::
Node
();
return
true
;
}
}
void
RunNodeTest
(
TEST
(
*
test
)(),
const
std
::
string
&
name
,
int
&
passed
,
int
&
total
)
{
...
...
@@ -324,6 +331,7 @@ namespace Test
RunNodeTest
(
&
Node
::
TempMapVariableAlias
,
"temp map variable alias"
,
passed
,
total
);
RunNodeTest
(
&
Node
::
Bool
,
"bool"
,
passed
,
total
);
RunNodeTest
(
&
Node
::
AutoBoolConversion
,
"auto bool conversion"
,
passed
,
total
);
RunNodeTest
(
&
Node
::
Reassign
,
"reassign"
,
passed
,
total
);
std
::
cout
<<
"Node tests: "
<<
passed
<<
"/"
<<
total
<<
" passed
\n
"
;
return
passed
==
total
;
...
...
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