Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7820405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:16:27+00:00 2026-06-02T07:16:27+00:00

I have an NSOutlineTableView that is displaying hierarchical HTML data, loaded from an HTML

  • 0

I have an NSOutlineTableView that is displaying hierarchical HTML data, loaded from an HTML parser (each HTML tag is an object with attributes and an array of it’s children). For some reason, this code crashes AFTER it has run through all the objects. That is to say, I see NSLog() results for all objects in the HTML, but after that the code crashes:

- (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item{

    if (item==nil) {
        item=rootNode;
    }
    NSLog(@"looking for child %d of element %@",index, item);
    return [[item children] objectAtIndex:index];

}


- (NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item{

    if (item==nil) {
        item=rootNode;
    }
    NSLog(@"Element %@ has %i children", item, [[item children] count]);
    return [[item children ]count];

}


- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item{

    NSLog(@"is item %@ with %@ children expandable?",item,[item children]);
    return [[item children] count]>0;

}


- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item{

    if (![item isKindOfClass:[HTMLNode class]]) {   //////CRASH ON THIS LINE (or at least in this function)
        return @"";
    }

    NSLog(@"Object value for: %@",item);

    return [NSString stringWithFormat:@"%@",[item description]];

}

Here is an example run:
HTML content:
@"<ul></ul><span class='spantext1'></span><span class='spantext2'></span>";

Output:

Element <HTMLNode: 0x7fb9234462a0> body has 3 children

looking for child 0 of element <HTMLNode: 0x7fb9234462a0> body

is item <HTMLNode: 0x7fb923437d40> ul with (
) children expandable?

Object value for: <HTMLNode: 0x7fb923437d40> ul

looking for child 1 of element <HTMLNode: 0x7fb9234462a0> body

is item <HTMLNode: 0x7fb9249255c0> span with (
) children expandable?

Object value for: <HTMLNode: 0x7fb9249255c0> span

looking for child 2 of element <HTMLNode: 0x7fb9234462a0> body

is item <HTMLNode: 0x7fb92491e1d0> span with (
) children expandable?

Object value for: <HTMLNode: 0x7fb92491e1d0> span
(lldb) (crash with EXC_BAD_ACCESS)

Here is the top of the call stack:

objc_msgSend() selector name: isKindOfClass:
objc[23702]: garbage collection is OFF

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib                 0x00007fff846e7110 objc_msgSend_vtable4 + 16
1   com.303DesignLabs.SiteStats     0x0000000109dd44fd -[HTMLTreeOutlineController outlineView:objectValueForTableColumn:byItem:] + 189 (HTMLTreeOutlineController.m:51)

It almost appears as if it’s trying to run objectValueForTableColumn once more, after all the data has been run thru. Like I said, the crash occurs after the entire object hierarchy has been run thru (as evidenced by terminal output). At any rate, before the crash the tableView appears on the screen for a split second, with all three elements in their respective rows.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T07:16:28+00:00Added an answer on June 2, 2026 at 7:16 am

    “EXC_BAD_ACCESS” usually means you’re trying access a nil object or pointer.

    And from what I can see in your code up there, it looks like you’re always assuming “[item children]” is not nil.

    What happens if “[item children]” has no children? is the result NULL? Should you be calling objectAtIndex or count on a NULL object? My guess is NO.

    You should probably return something sensible for each function if there are no children for any given item.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have one Doubt In MVC Architecture we can able to pass data from Controller
Have data that has this kind of structure. Will be in ascending order by
Have data that has this kind of structure: $input = [ { animal: 'cat',
Have a network location that shows paths in the 8.3 short format. I need
**Have it working now. I forgot to populate the Array List. How embarrassing. I'm
Have converted devise new session from erb to Haml but doens't work, this is
Have a bunch of WCF REST services hosted on Azure that access a SQL
Have a look at one of my websites: moskah.com The problem is that it
Have a simple contact us XPage created. Have server side validation in place that
Have a problem that seems easy on paper but i'm having a big problem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.