@@ -136,6 +136,7 @@ class DataStorage: NSObject, NSOutlineViewDataSource, NSOutlineViewDelegate {
136
136
let firstElementOfIdBuffer = UnsafeRawPointer ( cityGMLParser. currentObjectIdentifier ( withLength: & idLength) )
137
137
let idData = Data ( bytes: firstElementOfIdBuffer!, count: Int ( idLength) * MemoryLayout< Int8> . size)
138
138
objects. last!. id = String ( data: idData, encoding: . utf8) !
139
+ // Swift.print("Object with id \(objects.last!.id)")
139
140
140
141
var objectTypeLength : UInt = 0
141
142
let firstElementOfObjectTypeBuffer = UnsafeRawPointer ( cityGMLParser. currentObjectType ( withLength: & objectTypeLength) )
@@ -148,14 +149,24 @@ class DataStorage: NSObject, NSOutlineViewDataSource, NSOutlineViewDelegate {
148
149
var attributeNameLength : UInt = 0
149
150
let firstElementOfAttributeNameBuffer = UnsafeRawPointer ( cityGMLParser. currentAttributeName ( withLength: & attributeNameLength) )
150
151
let attributeNameData = Data ( bytes: firstElementOfAttributeNameBuffer!, count: Int ( attributeNameLength) * MemoryLayout< Int8> . size)
151
- let attributeName = String ( data: attributeNameData, encoding: . utf8) !
152
+ let attributeName = String ( data: attributeNameData, encoding: . utf8)
153
+ if attributeName == nil {
154
+ Swift . print ( " Couldn't parse attribute name with \( attributeNameData) " )
155
+ cityGMLParser. advanceAttributeIterator ( )
156
+ continue
157
+ }
152
158
153
159
var attributeValueLength : UInt = 0
154
160
let firstElementOfAttributeValueBuffer = UnsafeRawPointer ( cityGMLParser. currentAttributeValue ( withLength: & attributeValueLength) )
155
161
let attributeValueData = Data ( bytes: firstElementOfAttributeValueBuffer!, count: Int ( attributeValueLength) * MemoryLayout< Int8> . size)
156
- let attributeValue = String ( data: attributeValueData, encoding: . utf8) !
162
+ let attributeValue = String ( data: attributeValueData, encoding: . utf8)
163
+ if attributeValue == nil {
164
+ Swift . print ( " Couldn't parse attribute value with \( attributeValueData. base64EncodedString ( ) ) " )
165
+ cityGMLParser. advanceAttributeIterator ( )
166
+ continue
167
+ }
157
168
158
- objects. last!. attributes. append ( CityGMLObjectAttribute ( name: attributeName, value: attributeValue) )
169
+ objects. last!. attributes. append ( CityGMLObjectAttribute ( name: attributeName! , value: attributeValue! ) )
159
170
cityGMLParser. advanceAttributeIterator ( )
160
171
}
161
172
0 commit comments