Merge lp:~marcustomlinson/unity-scopes-api/lp-1410125-rtm into lp:unity-scopes-api/rtm-14.09

Proposed by Marcus Tomlinson
Status: Merged
Approved by: Michi Henning
Approved revision: 261
Merged at revision: 261
Proposed branch: lp:~marcustomlinson/unity-scopes-api/lp-1410125-rtm
Merge into: lp:unity-scopes-api/rtm-14.09
Diff against target: 53 lines (+12/-3)
3 files modified
src/scopes/internal/JsonCppNode.cpp (+5/-0)
src/scopes/internal/JsonSettingsSchema.cpp (+5/-1)
test/gtest/scopes/internal/JsonSettingsSchema/JsonSettingsSchema_test.cpp (+2/-2)
To merge this branch: bzr merge lp:~marcustomlinson/unity-scopes-api/lp-1410125-rtm
Reviewer Review Type Date Requested Status
Michi Henning (community) Approve
Review via email: mp+247418@code.launchpad.net

Commit message

Fixed smartscopesproxy crash due to json-cpp update

To post a comment you must log in.
Revision history for this message
Michi Henning (michihenning) wrote :

Yes, please!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/scopes/internal/JsonCppNode.cpp'
2--- src/scopes/internal/JsonCppNode.cpp 2014-08-18 08:12:22 +0000
3+++ src/scopes/internal/JsonCppNode.cpp 2015-01-23 12:23:57 +0000
4@@ -252,6 +252,11 @@
5
6 bool JsonCppNode::has_node(std::string const& node_name) const
7 {
8+ if (!root_)
9+ {
10+ throw unity::LogicException("Current node is empty");
11+ }
12+
13 return root_.isMember(node_name);
14 }
15
16
17=== modified file 'src/scopes/internal/JsonSettingsSchema.cpp'
18--- src/scopes/internal/JsonSettingsSchema.cpp 2014-08-28 00:20:56 +0000
19+++ src/scopes/internal/JsonSettingsSchema.cpp 2015-01-23 12:23:57 +0000
20@@ -181,7 +181,11 @@
21 void Setting::set_default_value(Json::Value const& v, Type expected_type)
22 {
23 auto v_param = v[parameters_key];
24- if (!v_param.isObject())
25+ if (v_param.isNull())
26+ {
27+ return;
28+ }
29+ else if (!v_param.isObject())
30 {
31 throw ResourceException("JsonSettingsSchema(): expected value of type object for \"parameters\", id = \"" + id_ + "\"");
32 }
33
34=== modified file 'test/gtest/scopes/internal/JsonSettingsSchema/JsonSettingsSchema_test.cpp'
35--- test/gtest/scopes/internal/JsonSettingsSchema/JsonSettingsSchema_test.cpp 2014-08-14 14:39:01 +0000
36+++ test/gtest/scopes/internal/JsonSettingsSchema/JsonSettingsSchema_test.cpp 2015-01-23 12:23:57 +0000
37@@ -397,7 +397,7 @@
38 {
39 "id": "x",
40 "type": "number",
41- "displayName": "X",
42+ "displayName": "X",
43 "parameters": {
44 "defaultValue": "banana"
45 }
46@@ -457,7 +457,7 @@
47 }
48 catch (ResourceException const& e)
49 {
50- EXPECT_STREQ("unity::ResourceException: JsonSettingsSchema(): missing \"parameters\" definition, id = \"x\"",
51+ EXPECT_STREQ("unity::ResourceException: JsonSettingsSchema(): missing \"displayName\" definition, id = \"x\"",
52 e.what());
53 }
54

Subscribers

People subscribed via source and target branches

to all changes: