Fixes

The two commits fix 2 specific problems:

1. parsing subtitles can lead to a buffer overflow
2. missing NULL pointer check