Skip to content

Commit 6fece0e

Browse files
committed
fixed segmentation fault in Entity.convert()
1 parent e7d83b8 commit 6fece0e

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

Source/ValueJSON.swift

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ public extension Entity {
1818

1919
var convertedValues = ValuesObject()
2020

21-
/*
2221
// convert attributes
2322
for (key, attribute) in self.attributes {
2423

@@ -65,15 +64,14 @@ public extension Entity {
6564

6665
convertedValues[key] = value
6766
}
68-
*/
6967

7068
// convert relationships
7169
for (key, relationship) in self.relationships {
7270

71+
let convertedValue: Value
72+
7373
if let jsonValue = JSONObject[key] {
7474

75-
let convertedValue: Value
76-
7775
switch relationship.type {
7876

7977
case .ToOne:
@@ -91,11 +89,11 @@ public extension Entity {
9189

9290
convertedValue = .Relationship(.ToMany(resourceIDs))
9391
}
94-
95-
convertedValues[key] = convertedValue
9692
}
9793

98-
else { convertedValues[key] = .Null }
94+
else { convertedValue = .Null }
95+
96+
convertedValues[key] = convertedValue
9997
}
10098

10199
return convertedValues

0 commit comments

Comments
 (0)