• ZILtoid1991@kbin.social
    link
    fedilink
    arrow-up
    2
    ·
    2 years ago

    The greatest fixes to all your pointer issues:

    1. Use a debugger, so you’ll know when it happens.
    2. A simple safety check goes very far, and is easy to implement.
    if (refVal != null) {
        //Do the thing
    } else {
        //Optional in case if your reference value is uninitialized, can be useful for certain things too
    }