From 156cce698093023d9e79a4ff4fb96f4e4d3019db Mon Sep 17 00:00:00 2001 From: Jason Sams Date: Wed, 3 Mar 2010 13:03:18 -0800 Subject: Improve RS error handling. On errors RS will now store the error and a message that can be read from the app. RS will then not continue rendering frames while an unchecked error is present until new state is received. --- libs/rs/rsScriptC.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'libs/rs/rsScriptC.cpp') diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp index b7e0b86e81b1..1f2377309a8f 100644 --- a/libs/rs/rsScriptC.cpp +++ b/libs/rs/rsScriptC.cpp @@ -62,6 +62,11 @@ void ScriptC::setupScript() uint32_t ScriptC::run(Context *rsc, uint32_t launchIndex) { + if (mProgram.mScript == NULL) { + rsc->setError(RS_ERROR_BAD_SCRIPT, "Attempted to run bad script"); + return 0; + } + Context::ScriptTLSStruct * tls = (Context::ScriptTLSStruct *)pthread_getspecific(Context::gThreadTLSKey); rsAssert(tls); @@ -154,7 +159,9 @@ void ScriptCState::runCompiler(Context *rsc, ScriptC *s) ACCchar buf[4096]; ACCsizei len; accGetScriptInfoLog(s->mAccScript, sizeof(buf), &len, buf); - LOGV(buf); + LOGE(buf); + rsc->setError(RS_ERROR_BAD_SCRIPT, "Error compiling user script."); + return; } if (s->mProgram.mInit) { -- cgit v1.2.3-59-g8ed1b