Permalink
Browse files

Merge pull request #11 from jmfee-usgs/null_origin_uncertainty

Fix null pointer exception when quakeml doesn't include originUncertaint...
  • Loading branch information...
2 parents 6863cf5 + e25e28f commit 915750387dd07d0ca2ab5b67e5e3a6232006100c @emartinez-usgs emartinez-usgs committed Nov 25, 2013
Showing with 5 additions and 8 deletions.
  1. +5 −8 src/gov/usgs/earthquake/event/QuakemlToCubeConverter.java
@@ -225,14 +225,11 @@ public CubeEvent convertQuakemlEventMessage(Quakeml message, Event event,
// horizontal uncertainty
OriginUncertainty originUncertainty = origin.getOriginUncertainty();
- if (OriginUncertaintyDescription.HORIZONTAL_UNCERTAINTY
- .equals(originUncertainty.getPreferredDescription())) {
- // TODO: set this regardless of preferred description?
- if (originUncertainty.getHorizontalUncertainty() != null) {
- cubeEvent.setHorizontalError(originUncertainty
- .getHorizontalUncertainty().divide(
- CubeToQuakemlConverter.METERS_PER_KILOMETER));
- }
+ if (originUncertainty != null &&
+ originUncertainty.getHorizontalUncertainty() != null) {
+ cubeEvent.setHorizontalError(originUncertainty
+ .getHorizontalUncertainty().divide(
+ CubeToQuakemlConverter.METERS_PER_KILOMETER));
}
OriginQuality originQuality = origin.getQuality();

0 comments on commit 9157503

Please sign in to comment.