Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
9.2.2023: Due to updates GitLab will be unavailable for some minutes between 9:00 and 11:00.
Open sidebar
vadere
vadere
Commits
6518661c
Commit
6518661c
authored
Nov 04, 2016
by
Jakob Schöttl
Browse files
Bugfixes: Null pointer exceptions on null attributes
parent
7094b9a9
Changes
2
Hide whitespace changes
Inline
Side-by-side
VadereSimulator/src/org/vadere/simulator/projects/dataprocessing/processor/DataProcessor.java
View file @
6518661c
...
...
@@ -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
();
}
}
VadereState/src/org/vadere/state/scenario/Topography.java
View file @
6518661c
...
...
@@ -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.
*/
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment