--- generic/tixGrSort.c
+++ generic/tixGrSort.c
@@ -426,6 +426,7 @@ SortCompareProc(first, second)
     } else {
 	int oldLength;
 	char *end;
+	const char *result;
 
 	/*
 	 * Generate and evaluate a command to determine which string comes
@@ -447,8 +448,9 @@ SortCompareProc(first, second)
 	 * Parse the result of the command.
 	 */
 
-	order = strtol(sortInterp->result, &end, 0);
-	if ((end == sortInterp->result) || (*end != 0)) {
+	result = Tcl_GetStringResult(sortInterp);
+	order = strtol(result, &end, 0);
+	if ((end == result) || (*end != 0)) {
 	    Tcl_ResetResult(sortInterp);
 	    Tcl_AppendResult(sortInterp,
 		    "comparison command returned non-numeric result",
