Prevented possible NullPointerException's
[jpa-converters] / src / main / java / de / juplo / jpa / converters / YearMonthConverter.java
index 47718d9..f84b676 100644 (file)
@@ -15,12 +15,16 @@ public class YearMonthConverter implements AttributeConverter<YearMonth, String>
   @Override
   public String convertToDatabaseColumn(YearMonth yearmonth)
   {
+    if (yearmonth == null)
+      return null;
     return yearmonth.toString();
   }
 
   @Override
   public YearMonth convertToEntityAttribute(String string)
   {
+    if (string == null)
+      return null;
     return YearMonth.parse(string);
   }
 }