mirror of
https://github.com/textmate/textmate.git
synced 2026-01-21 04:38:13 -05:00
Add safety checks
Since 10% of reported crashes are in synchronizeWindowTitle and seems to be about not having a proper document pointer, I am adding these checks and some debug output — don’t understand how we would get into this situation though.
This commit is contained in:
@@ -506,7 +506,20 @@ OAK_DEBUG_VAR(DocumentController);
|
||||
|
||||
- (void)synchronizeWindowTitle
|
||||
{
|
||||
if(selectedTabIndex >= documentTabs.size())
|
||||
{
|
||||
fprintf(stderr, "*** error: selected tab out of bounds: %zu >= %zu\n", selectedTabIndex, documentTabs.size());
|
||||
return;
|
||||
}
|
||||
|
||||
document::document_ptr doc = [self selectedDocument];
|
||||
|
||||
if(!doc)
|
||||
{
|
||||
fprintf(stderr, "*** error: no document (synchronizeWindowTitle)\n");
|
||||
return;
|
||||
}
|
||||
|
||||
std::string docDirectory = doc->path() != NULL_STR ? path::parent(doc->path()) : to_s(self.untitledSavePath);
|
||||
|
||||
std::map<std::string, std::string> map;
|
||||
|
||||
Reference in New Issue
Block a user