Make sure ldoc isn't nil. This happened when running ldoc on a random folder of lua files.