mozilla/dxr — pull request #347 by ClementDagneau (2014-10-04 19:06:58+00:00)
Title: Fix crash in dxr/build.py when source tree is empty.

Indexing an empty source tree causes the following crash:
```
Finalize database:
- Building database statistics for query optimization
- Running integrity check
Building HTML for the 'code' tree.
- Initializing worker pool
- Enqueuing jobs
Traceback (most recent call last):
File "/usr/local/bin/dxr-build.py", line 10, in
execfile(__file__)
File "/home/vagrant/dxr/bin/dxr-build.py", line 56, in
main()
File "/home/vagrant/dxr/bin/dxr-build.py", line 52, in main
verbose=options.verbose)
File "/home/vagrant/dxr/dxr/build.py", line 177, in build_instance
run_html_workers(tree, config, max_file_id)
File "/home/vagrant/dxr/dxr/build.py", line 472, in run_html_workers
(start, end) in _sliced_range_bounds(1, max_file_id, 500)]
File "/home/vagrant/dxr/dxr/build.py", line 461, in _sliced_range_bounds
this_min = this_max + 1
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
```
It doesn't make much sense to index an empty source tree but ```dxr-build.py``` should not crash. The build now earlies out if ```max_file_id``` is ```None``` which happens when the source tree is empty.