Earliest availability of getCurrentAccountBook()

Max Pixel's Avatar

Max Pixel

02 Jun, 2020 05:05 AM

I got a null pointer exception upon opening Moneydance. It came from my extension's init(), the line where I call getCurrentAccountBook() on the Context. This was the first time I opened Moneydance with the extension installed - I hadn't noticed it when the extension initialized upon installation because the "current account book" has been set by that point.

I have a workaround in the meantime, but I would like to know if there is an event that is the earliest point in time that I can expect the current account book to be available. Perhaps one of the mysterious "available at a later date" handleEvent(String) events?

  1. Support Staff 1 Posted by Sean Reilly on 02 Jun, 2020 08:35 AM

    Sean Reilly's Avatar

    Hi Max,

    You can override the handleEvent(String) method in your extension to be notified when files are opened, closed, etc:

      /**
       * Receive notifications of application events.
       */
      public void handleEvent(String appEvent) {
        if (appEvent.startsWith(AppEventManager.FILE_OPENED)) {
          ...
        }
      }
    

    --
    Sean Reilly
    Developer, The Infinite Kind
    https://infinitekind.com

  2. Max Pixel closed this discussion on 11 Jun, 2020 05:32 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac