Fixed crash when lastPathComponent() is called on an empty string (#911)