Commit 6518661c authored by Jakob Schöttl's avatar Jakob Schöttl
Browse files

Bugfixes: Null pointer exceptions on null attributes

parent 7094b9a9
......@@ -65,7 +65,7 @@ public abstract class DataProcessor<K extends DataKey<K>, V> {
}
public AttributesProcessor getAttributes() {
return this.attributes;
return attributes;
}
public void setAttributes(AttributesProcessor attributes) {
......@@ -122,7 +122,8 @@ public abstract class DataProcessor<K extends DataKey<K>, V> {
}
public void sealAttributes() {
attributes.seal();
if (attributes != null) // some processors might not have attributes
attributes.seal();
}
}
......@@ -72,6 +72,7 @@ public class Topography {
allOtherAttributes.add(attributes);
allOtherAttributes.add(attributesCar);
allOtherAttributes.add(attributesPedestrian);
removeNullAttributes();
obstacles = new LinkedList<>();
stairs = new LinkedList<>();
......@@ -92,6 +93,15 @@ public class Topography {
}
/** Clean up the list of attributes by removing {@code null}. */
private void removeNullAttributes() {
allOtherAttributes.remove(null);
// Actually, only attributes, not nulls should be added to this set.
// But sometimes null is passed as attributes and added to the set,
// although it is bad practice to pass null in the first place
// (as constructor argument).
}
/**
* Creates an empty scenario where bounds and finishTime are empty / zero.
*/
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment