Skip to content

Conversation

@afq984
Copy link

@afq984 afq984 commented Aug 4, 2017

If the cumulative size is 0, the program will crash with ZeroDivisionError

The PR should fix that.

afg@sceptile ~/p/pyminifier (master)> 
python -m pyminifier __init__.py empty.py 
__init__.py (0) reduced to 64 bytes (0% of original size)
empty.py (0) reduced to 64 bytes (0% of original size)
Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/afg/projects/pyminifier/pyminifier/__main__.py", line 175, in <module>
    main()
  File "/home/afg/projects/pyminifier/pyminifier/__main__.py", line 171, in main
    pyminify(options, files)
  File "/home/afg/projects/pyminifier/pyminifier/__init__.py", line 271, in pyminify
    (float(cumulative_new) / float(cumulative_size) * 100), 2)
ZeroDivisionError: float division by zero

EPiC-APOC added a commit to EPiC-APOC/pyminifier that referenced this pull request May 3, 2020
…@2019

        (origineel =v2.2 @ https://github.com/liftoff/pyminifier)

- - -

+(minor)Changes ;
incl. PR liftoff#92 'fix a ZeroDivisonError when cumulative_size is zero' :
    liftoff@f593e6f
    (04 Aug 2017)

incl. PR liftoff#57 'Fix reduce_operators() with check whether prev_tok is not None' :
    liftoff@3a95839
    (12 Feb 2016)

- - -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant