(TCommandHandler -PerformCommand) NULL pointer invoked

1625665

Feb 4 1997 10:09AM


i came across the following memory trasher while trying to figure out why my applescript commands weren't undoable and weren't being deleted.

in TCommandHandler::PerformCommand is the following code (for commands for which fUseAppleEvent is false):

volatileCommand->DoIt();

if (wasUndoAble &&
   !TUndoHandler::fgUndoHandler->FindTransaction(volatileCommand))
   //**************************************************
      volatileCommand = NULL;                      // The command went away
      
      volatileCommand->fCommandDone = true; // Bug
   //**************************************************
note the setting of volatileCommand->fCommandDone after setting volatileCommand to null. i fixed this with:
if (volatileCommand)
   volatileCommand->fCommandDone = true;

Fix:

Added "else" keyword before line of "volatileCommand->fCommandDone = true".