From ed609248ec4d92e0b2fb96d28615035e26293019 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Mon, 26 Apr 2010 00:45:59 -0700 Subject: Fixed #245: Script compile error from OpenSim crashes Imprudence --- linden/indra/llui/lltexteditor.cpp | 5 +++++ linden/indra/newview/llpreviewscript.cpp | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/linden/indra/llui/lltexteditor.cpp b/linden/indra/llui/lltexteditor.cpp index c4f839b..00fa517 100644 --- a/linden/indra/llui/lltexteditor.cpp +++ b/linden/indra/llui/lltexteditor.cpp @@ -886,6 +886,11 @@ S32 LLTextEditor::getCursorPosFromLocalCoord( S32 local_x, S32 local_y, BOOL rou void LLTextEditor::setCursor(S32 row, S32 column) { + // Make sure we're not trying to set the cursor anywhere + // it can't go by always setting the min to 0 -- MC + row = (row < 0) ? 0 : row; + column = (column < 0) ? 0 : column; + const llwchar* doc = mWText.c_str(); const char CR = 10; while(row--) diff --git a/linden/indra/newview/llpreviewscript.cpp b/linden/indra/newview/llpreviewscript.cpp index be8396a..d200e32 100644 --- a/linden/indra/newview/llpreviewscript.cpp +++ b/linden/indra/newview/llpreviewscript.cpp @@ -1663,8 +1663,11 @@ void LLLiveLSLEditor::callbackLSLCompileFailed(const LLSD& compile_errors) line < compile_errors.endArray(); line++) { - LLSD row; + // Note: OpenSim screws up and sends the wrong values for (row, column). + // (As of 2010-04-25: rows start at -1 instead of 0, and columns start at + // 1 instead of 0) -- MC std::string error_message = line->asString(); + LLSD row; LLStringUtil::stripNonprintable(error_message); row["columns"][0]["value"] = error_message; row["columns"][0]["font"] = "OCRA"; -- cgit v1.1