Uploaded image for project: 'Magnolia UI'
  1. Magnolia UI
  2. MGNLUI-3623

Division by zero in JcrThumbnailContainer with less than 3 assets

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Neutral Neutral
    • None
    • 5.4.2
    • None
    • None

      When there are less than 3 assets opening the thumbnail view in the assets app results in a division by zero error.

      In info.magnolia.ui.workbench.thumbnail.JcrThumbnailContainer#setPageSize pageSize gets divided by 3, but since this in an integer division 2/3 = 0.

      Then in AbstractJcrContainer#updateOffsetAndCache you get a division by zero in this code:

      currentOffset = (index / (pageLength * cacheRatio)) * (pageLength * cacheRatio);

      (Maybe this calculation should be more like the one in AbstractJcrContainer#indexOfId, which has a similar statement, but with +1 in the division?)

        Acceptance criteria

              Unassigned Unassigned
              breun Nils Breunese
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD