diff --git a/src/main/java/org/ntlab/acanthus_server/resources/gallery/LayersRest.java b/src/main/java/org/ntlab/acanthus_server/resources/gallery/LayersRest.java index c25ab36..88b550c 100644 --- a/src/main/java/org/ntlab/acanthus_server/resources/gallery/LayersRest.java +++ b/src/main/java/org/ntlab/acanthus_server/resources/gallery/LayersRest.java @@ -59,10 +59,12 @@ @Path("/{aid}/pageMap/{pid}/layers/{layerNo}") @GET @Produces(MediaType.APPLICATION_JSON) - public Integer getStrokeSize(@PathParam("aid") Integer aid, @PathParam("pid") Integer pid, @PathParam("layerNo") Integer layerNo) { + public Integer getStrokeNo(@PathParam("aid") Integer aid, @PathParam("pid") Integer pid, @PathParam("layerNo") Integer layerNo) { var pages = gallery.getAnimationByAid(aid).getPages(); + var strokes = pages.get(pid).getLayers().get(layerNo).getStrokes(); - return pages.get(pid).getLayers().get(layerNo).getStrokes().size(); + if (strokes == null) return null; + return (strokes.size() - 1); } // _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/