diff options
author | Martin Kiewitz | 2014-01-27 23:31:40 +0100 |
---|---|---|
committer | Martin Kiewitz | 2014-01-27 23:31:40 +0100 |
commit | 07568931cef05d609e4a2335593fb9ed53ecee57 (patch) | |
tree | 6b7ac5394241e92879084a858aa1f4ec3be12137 | |
parent | e59c652b4bb24b353ab9e867188de8c675045569 (diff) | |
download | scummvm-rg350-07568931cef05d609e4a2335593fb9ed53ecee57.tar.gz scummvm-rg350-07568931cef05d609e4a2335593fb9ed53ecee57.tar.bz2 scummvm-rg350-07568931cef05d609e4a2335593fb9ed53ecee57.zip |
SCI: fix null pointer access in logKernelCall
method was/is used for debugging only
CID 1003612
-rw-r--r-- | engines/sci/engine/scriptdebug.cpp | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp index 277437109c..37ec4e8850 100644 --- a/engines/sci/engine/scriptdebug.cpp +++ b/engines/sci/engine/scriptdebug.cpp @@ -737,37 +737,39 @@ void logKernelCall(const KernelFunction *kernelCall, const KernelSubFunction *ke case SIG_TYPE_REFERENCE: { SegmentObj *mobj = s->_segMan->getSegmentObj(argv[parmNr].getSegment()); - switch (mobj->getType()) { - case SEG_TYPE_HUNK: - { - HunkTable *ht = (HunkTable *)mobj; - int index = argv[parmNr].getOffset(); - if (ht->isValidEntry(index)) { - // NOTE: This ", deleted" isn't as useful as it could - // be because it prints the status _after_ the kernel - // call. - debugN(" ('%s' hunk%s)", ht->_table[index].type, ht->_table[index].mem ? "" : ", deleted"); - } else - debugN(" (INVALID hunk ref)"); - break; - } - default: - // TODO: Any other segment types which could - // use special handling? - - if (kernelCall->function == kSaid) { - SegmentRef saidSpec = s->_segMan->dereference(argv[parmNr]); - if (saidSpec.isRaw) { - debugN(" ('"); - g_sci->getVocabulary()->debugDecipherSaidBlock(saidSpec.raw); - debugN("')"); + if (mobj) { + switch (mobj->getType()) { + case SEG_TYPE_HUNK: + { + HunkTable *ht = (HunkTable *)mobj; + int index = argv[parmNr].getOffset(); + if (ht->isValidEntry(index)) { + // NOTE: This ", deleted" isn't as useful as it could + // be because it prints the status _after_ the kernel + // call. + debugN(" ('%s' hunk%s)", ht->_table[index].type, ht->_table[index].mem ? "" : ", deleted"); + } else + debugN(" (INVALID hunk ref)"); + break; + } + default: + // TODO: Any other segment types which could + // use special handling? + + if (kernelCall->function == kSaid) { + SegmentRef saidSpec = s->_segMan->dereference(argv[parmNr]); + if (saidSpec.isRaw) { + debugN(" ('"); + g_sci->getVocabulary()->debugDecipherSaidBlock(saidSpec.raw); + debugN("')"); + } else { + debugN(" (non-raw said-spec)"); + } } else { - debugN(" (non-raw said-spec)"); + debugN(" ('%s')", s->_segMan->getString(argv[parmNr]).c_str()); } - } else { - debugN(" ('%s')", s->_segMan->getString(argv[parmNr]).c_str()); + break; } - break; } } default: |