quelea-projection / Quelea

Open source projection software for churches.
https://quelea.org
GNU General Public License v3.0
154 stars 145 forks source link

Utils.getEncoding - treat NULL value better #604

Closed jbubik closed 1 year ago

jbubik commented 1 year ago

Though UniversalDetector.detectCharset() is in try-catch block, it doesn't always emit Exception to signal failure. It returns NULL sometimes. This special case is treated with this commit. It can be tested using an empty file (length 0 bytes).

Not that I hit an error with the original implementation, it is more of a safety-fix. Was playing around EpicWorshipParser throwing an empty file at it ;-)