File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed
src/request_body_processor Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -127,14 +127,19 @@ int JSON::addArgument(const std::string& value) {
127
127
}
128
128
}
129
129
130
- JSONContainerArray *a = dynamic_cast <JSONContainerArray *>(
131
- m_containers.back ());
132
- if (a) {
133
- a->m_elementCounter ++;
130
+ if (m_containers.size () > 0 ) {
131
+ JSONContainerArray *a = dynamic_cast <JSONContainerArray *>(
132
+ m_containers.back ());
133
+ if (a) {
134
+ a->m_elementCounter ++;
135
+ } else {
136
+ data = getCurrentKey ();
137
+ }
134
138
} else {
135
139
data = getCurrentKey ();
136
140
}
137
141
142
+
138
143
m_transaction->addArgument (" JSON" , path + data, value, 0 );
139
144
140
145
return 1 ;
@@ -222,6 +227,10 @@ int JSON::yajl_start_array(void *ctx) {
222
227
223
228
int JSON::yajl_end_array (void *ctx) {
224
229
JSON *tthis = reinterpret_cast <JSON *>(ctx);
230
+ if (tthis->m_containers .size () <= 0 ) {
231
+ return 1 ;
232
+ }
233
+
225
234
JSONContainer *a = tthis->m_containers .back ();
226
235
tthis->m_containers .pop_back ();
227
236
delete a;
@@ -252,6 +261,10 @@ int JSON::yajl_start_map(void *ctx) {
252
261
*/
253
262
int JSON::yajl_end_map (void *ctx) {
254
263
JSON *tthis = reinterpret_cast <JSON *>(ctx);
264
+ if (tthis->m_containers .size () <= 0 ) {
265
+ return 1 ;
266
+ }
267
+
255
268
JSONContainer *a = tthis->m_containers .back ();
256
269
tthis->m_containers .pop_back ();
257
270
delete a;
You can’t perform that action at this time.
0 commit comments