Ard Schrijvers pushed to branch master at cms-community / hippo-essentials
Commits: 58009bd4 by Ard Schrijvers at 2016-03-16T13:15:00+01:00 ESSENTIALS-835 add null checks to avoid NPE on missing images (or link). HippoHtmlAdapter already got the null check - - - - - 2 changed files: - components/hst/src/main/java/org/onehippo/cms7/essentials/components/rest/adapters/HippoGalleryImageAdapter.java - components/hst/src/main/java/org/onehippo/cms7/essentials/components/rest/adapters/RestLinkAdapter.java Changes: ===================================== components/hst/src/main/java/org/onehippo/cms7/essentials/components/rest/adapters/HippoGalleryImageAdapter.java ===================================== --- a/components/hst/src/main/java/org/onehippo/cms7/essentials/components/rest/adapters/HippoGalleryImageAdapter.java +++ b/components/hst/src/main/java/org/onehippo/cms7/essentials/components/rest/adapters/HippoGalleryImageAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 Hippo B.V. (http://www.onehippo.com) + * Copyright 2014-2016 Hippo B.V. (http://www.onehippo.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,9 @@ public class HippoGalleryImageAdapter extends XmlAdapter<HippoGalleryImageRepres @Override public HippoGalleryImageRepresentation marshal(HippoGalleryImageSet bean) throws Exception { + if (bean == null) { + return null; + } HippoGalleryImageRepresentation representation = new HippoGalleryImageRepresentation(); representation.represent(bean); return representation; ===================================== components/hst/src/main/java/org/onehippo/cms7/essentials/components/rest/adapters/RestLinkAdapter.java ===================================== --- a/components/hst/src/main/java/org/onehippo/cms7/essentials/components/rest/adapters/RestLinkAdapter.java +++ b/components/hst/src/main/java/org/onehippo/cms7/essentials/components/rest/adapters/RestLinkAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 Hippo B.V. (http://www.onehippo.com) + * Copyright 2014-2016 Hippo B.V. (http://www.onehippo.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,9 @@ public class RestLinkAdapter extends XmlAdapter<RestLink, HippoDocument> { @Override public RestLink marshal(HippoDocument bean) throws Exception { + if (bean == null) { + return null; + } return new RestLink(bean); } View it on GitLab: https://code.onehippo.org/cms-community/hippo-essentials/commit/58009bd49db4698c43eda7e397d29e8066e98d65
_______________________________________________ Hippocms-svn mailing list Hippocms-svn@lists.onehippo.org https://lists.onehippo.org/mailman/listinfo/hippocms-svn