JSON decoder errors aren't properly logged

Bug #1193211 reported by Vadim Peretokin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mudlet
Fix Released
Undecided
Chris

Bug Description

I saw this in the errors view:

[ERROR:] object:<JSON decoder error:> function:<json_to_value>
         <>

With no JSON error attached. Looking at the code:

            string e;
            if( lua_isstring( L, 1 ) )
            {
                e = "Lua error:";
                e += lua_tostring( L, 1 );
            }
            QString _n = "JSON decoder error:";
            QString _f = "json_to_value";
            logError( e, _n, _f );

It should be using -1 as the index for the top of the stack, because 1 might not be the top (which seems to be the case in my error).

Revision history for this message
Vadim Peretokin (vperetokin) wrote :

That is to say, the fixed code should be:

            string e;
            if( lua_isstring( L, -1 ) )
            {
                e = "Lua error:";
                e += lua_tostring( L, -1 );
            }
            QString _n = "JSON decoder error:";
            QString _f = "json_to_value";
            logError( e, _n, _f );

Revision history for this message
Chris (chrismudlet) wrote :
Changed in mudlet:
status: New → Fix Committed
Revision history for this message
Chris (chrismudlet) wrote :

in Mudlet/development

Changed in mudlet:
assignee: nobody → Chris (chrismudlet)
milestone: none → 3.0
Changed in mudlet:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.