Skip to content

Fix invalid zoom when opening document with "adjust-open width" option

Georgy Komarov requested to merge jubnzv/zathura:fix-incorrect-zoom into develop

This commit fixes attempt to set invalid zoom value when opening document for the first time with adjust-open width option.

In this case function zathura_document_get_document_size returns document_width == 0. This leads to division to NaN at this line: https://git.pwmt.org/pwmt/zathura/-/blob/develop/zathura/zathura.c#L1699 and further attempt to set INFINITY zoom value at this line: https://git.pwmt.org/pwmt/zathura/-/blob/develop/zathura/zathura.c#L1707.

Steps to reproduce:

  1. Set set adjust-open width in the configuration file
  2. Clean zathura history: mv ~/.local/share/zathura/history{,.bak}
  3. Open an arbitrary document.

With pdf-poppler backend, you'll get an empty window and endless warnings in the terminal:

image

With muPdf backend, the zathura will not be open at all:

image

Merge request reports