Skip to content

Commit 9755006

Browse files
committed
Resolve bug in Node.removeChild
removeChild treated `children` as a List of nodes, rather than a map of String,Node (nodeNames as the String). This meant trying to remove the Node from the list would silently fail every call.
1 parent fc2c8ef commit 9755006

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# ChangeLog
22

3+
* v1.0.6 - Fix a logic error in removeChild method of Nodes.
34
* v1.0.5 - Ensure that QOS downgrades are propagated.
45
* v1.0.4+1 - Map logger names to match DSA log levels.
56
* v1.0.4 - Forward any errors generated by a `list` request to the requester.

lib/src/common/node.dart

+7-2
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,15 @@ class Node {
7373
/// [input] can be either an instance of [Node] or a [String].
7474
String removeChild(dynamic input) {
7575
if (input is String) {
76-
children.remove(getChild(input));
76+
children.remove(input);
7777
return input;
7878
} else if (input is Node) {
79-
children.remove(input);
79+
for (var nodeName in children.keys.toList()) {
80+
if ((input as Node) == children[nodeName]) {
81+
children.remove(nodeName);
82+
return nodeName;
83+
}
84+
}
8085
} else {
8186
throw new Exception("Invalid Input");
8287
}

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: dslink
2-
version: 1.0.5
2+
version: 1.0.6
33
description: "DSA IoT Platform - DSLink SDK for Dart"
44
homepage: "http://iot-dsa.org"
55
documentation: "https://iot-dsa.github.io/docs/sdks/dart/"

0 commit comments

Comments
 (0)