]> granicus.if.org Git - postgis/commitdiff
Do not call lwmessage_truncate if not needed (an prior to checking the args passed...
authorSandro Santilli <strk@keybit.net>
Tue, 8 Feb 2011 17:42:36 +0000 (17:42 +0000)
committerSandro Santilli <strk@keybit.net>
Tue, 8 Feb 2011 17:42:36 +0000 (17:42 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@6789 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/lwgeom_pg.c

index 830e3a72e9dee3244753ec9a2ae3d0bd2e739a03..0a48b71fdc2ba1e5153d195b2b4b91268025687a 100644 (file)
@@ -64,13 +64,16 @@ pg_parser_errhint(LWGEOM_PARSER_RESULT *lwg_parser_result)
 {
        char *hintbuffer;
 
-       /* Return a copy of the input string start truncated at the error location */
-       hintbuffer = lwmessage_truncate((char *)lwg_parser_result->wkinput, 0, lwg_parser_result->errlocation - 1, 40, 0);
-
        /* Only display the parser position if the location is > 0; this provides a nicer output when the first token
           within the input stream cannot be matched */
        if (lwg_parser_result->errlocation > 0)
        {
+               /* Return a copy of the input string start truncated
+                * at the error location */
+               hintbuffer = lwmessage_truncate(
+                       (char *)lwg_parser_result->wkinput, 0,
+                       lwg_parser_result->errlocation - 1, 40, 0);
+
                ereport(ERROR,
                        (errmsg("%s", lwg_parser_result->message),
                         errhint("\"%s\" <-- parse error at position %d within geometry", hintbuffer, lwg_parser_result->errlocation))