From c6ea4c6cba8789e5510a9a1c93d9d8ac439b71e7 Mon Sep 17 00:00:00 2001 From: phaicm <21993937+phaicm@users.noreply.github.com> Date: Sun, 21 Jun 2020 22:39:00 -0400 Subject: [PATCH] Temp Fix Potential Crash and Decorator Added try/catch for script export incase ds_Owner is NULL and default input_index to 0. Changed Decorator for type Check incase temp is NoneType. --- SuperScriptMaterializer/script_export.cpp | 10 +++++++++- SuperScriptViewer/DecoratorCore.py | 14 ++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/SuperScriptMaterializer/script_export.cpp b/SuperScriptMaterializer/script_export.cpp index 91dc759..9830f82 100644 --- a/SuperScriptMaterializer/script_export.cpp +++ b/SuperScriptMaterializer/script_export.cpp @@ -29,7 +29,15 @@ inline void generate_pLink_in_pIn(CKContext* ctx, CKParameterIn* cache, scriptDa //WARNING: untested doe to GetClassID() may have chance to return Attributes or CKDataArray accoring to document if (helper->_db_pLink->input_is_bb = (ds_Owner->GetClassID() != CKCID_PARAMETEROPERATION)) { //bb - helper->_db_pLink->input_index = ((CKBehavior*)ds_Owner)->GetOutputParameterPosition((CKParameterOut*)directSource); + __try + { + helper->_db_pLink->input_index = ((CKBehavior*)ds_Owner)->GetOutputParameterPosition((CKParameterOut*)directSource); + } + __except (EXCEPTION_EXECUTE_HANDLER) + { + //Default to 0 + helper->_db_pLink->input_index = 0; + } } else { //pOper diff --git a/SuperScriptViewer/DecoratorCore.py b/SuperScriptViewer/DecoratorCore.py index 0512cef..e9cd14c 100644 --- a/SuperScriptViewer/DecoratorCore.py +++ b/SuperScriptViewer/DecoratorCore.py @@ -505,10 +505,16 @@ def buildCell(exDb, deDb, target, currentGraphBlockCell): exCur.execute("SELECT [name], [type] FROM {} WHERE [thisobj] == ?".format(tableName), (i,)) temp = exCur.fetchone() - # submit to database and map - currentGraphBlockCell[i] = dcv.BlockCellItem(x, y, dcv.CELL_WIDTH, dcv.CELL_HEIGHT) - deCur.execute("INSERT INTO cell VALUES (?, ?, ?, ?, ?, ?, ?)", - (target, i, temp[0], temp[1], x, y, (dcv.CellType.SHORTCUT if cache.isshortcut else dcv.CellType.PLOCAL))) + if temp is not None: + # submit to database and map + currentGraphBlockCell[i] = dcv.BlockCellItem(x, y, dcv.CELL_WIDTH, dcv.CELL_HEIGHT) + deCur.execute("INSERT INTO cell VALUES (?, ?, ?, ?, ?, ?, ?)", + (target, i, temp[0], temp[1], x, y, (dcv.CellType.SHORTCUT if cache.isshortcut else dcv.CellType.PLOCAL))) + else: + # submit to database and map + currentGraphBlockCell[i] = dcv.BlockCellItem(x, y, dcv.CELL_WIDTH, dcv.CELL_HEIGHT) + deCur.execute("INSERT INTO cell VALUES (?, ?, ?, ?, ?, ?, ?)", + (target, i, "UNKNOWN", "UNKNOWN", x, y, (dcv.CellType.SHORTCUT if cache.isshortcut else dcv.CellType.PLOCAL))) # comput size and update database and currentGraphBlockCell graphX = 0