fixing possible null ptr access or memory leaks according to analyzer

This commit is contained in:
Stefan Csomor
2017-06-07 17:50:17 +02:00
parent 2f4b249fcf
commit 76305b53ad
4 changed files with 10 additions and 10 deletions

View File

@@ -856,16 +856,16 @@ bool wxNSTextViewControl::GetStyle(long position, wxTextAttr& style)
if (position < (long) [[m_textView string] length])
{
NSTextStorage* storage = [m_textView textStorage];
font = [[storage attribute:NSFontAttributeName atIndex:position effectiveRange:NULL] autorelease];
bgcolor = [[storage attribute:NSBackgroundColorAttributeName atIndex:position effectiveRange:NULL] autorelease];
fgcolor = [[storage attribute:NSForegroundColorAttributeName atIndex:position effectiveRange:NULL] autorelease];
font = [storage attribute:NSFontAttributeName atIndex:position effectiveRange:NULL];
bgcolor = [storage attribute:NSBackgroundColorAttributeName atIndex:position effectiveRange:NULL];
fgcolor = [storage attribute:NSForegroundColorAttributeName atIndex:position effectiveRange:NULL];
}
else
{
NSDictionary* attrs = [m_textView typingAttributes];
font = [[attrs objectForKey:NSFontAttributeName] autorelease];
bgcolor = [[attrs objectForKey:NSBackgroundColorAttributeName] autorelease];
fgcolor = [[attrs objectForKey:NSForegroundColorAttributeName] autorelease];
font = [attrs objectForKey:NSFontAttributeName];
bgcolor = [attrs objectForKey:NSBackgroundColorAttributeName];
fgcolor = [attrs objectForKey:NSForegroundColorAttributeName];
}
if (font)