Changeset 42
- Timestamp:
- 03/08/07 16:28:22 (2 years ago)
- Files:
-
- blog-service/trunk/bs-manager.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
blog-service/trunk/bs-manager.c
r41 r42 259 259 260 260 if (error) { 261 GError *gerror = g_error_new( 262 g_quark_from_string("blog-service"), 263 error->error_code, 264 "%s", 265 error->error_string); 266 dbus_g_method_return_error(clo->context, gerror); 261 if (clo->context) { 262 GError *gerror = g_error_new( 263 g_quark_from_string("blog-service"), 264 error->error_code, 265 "%s", 266 error->error_string); 267 dbus_g_method_return_error(clo->context, gerror); 268 } 267 269 blog_post_free(post); 268 } 269 dbus_g_method_return(clo->context, status); 270 return; 271 } 272 if (clo->context) { 273 dbus_g_method_return(clo->context, status); 274 } 270 275 271 276 if (!status) { … … 345 350 346 351 if (!(blog = g_hash_table_lookup(priv->blogs, blog_id))) { 347 error = g_error_new(g_quark_from_string("blog-service"), 348 404, 349 "No such blog." 350 ); 351 dbus_g_method_return_error(context, error); 352 if (context) { 353 error = g_error_new(g_quark_from_string("blog-service"), 354 404, 355 "No such blog." 356 ); 357 dbus_g_method_return_error(context, error); 358 } 352 359 return FALSE; 353 360 } … … 361 368 362 369 if (!clo->post->title || !clo->post->content) { 363 error = g_error_new(g_quark_from_string("blog-service"),364 412,365 "No title or content."366 );367 370 blog_post_free(clo->post); 368 371 g_free(clo); 369 dbus_g_method_return_error(context, error); 372 if (context) { 373 error = g_error_new(g_quark_from_string("blog-service"), 374 412, 375 "No title or content." 376 ); 377 dbus_g_method_return_error(context, error); 378 } 370 379 return FALSE; 371 380 } … … 396 405 397 406 if (!(blog = g_hash_table_lookup(priv->blogs, blog_id))) { 398 error = g_error_new(g_quark_from_string("blog-service"), 399 404, 400 "No such blog." 401 ); 402 dbus_g_method_return_error(context, error); 407 if (context) { 408 error = g_error_new(g_quark_from_string("blog-service"), 409 404, 410 "No such blog."); 411 dbus_g_method_return_error(context, error); 412 } 403 413 return FALSE; 404 414 } … … 414 424 415 425 if (!post) { 416 error = g_error_new(g_quark_from_string("blog-service"), 417 404, 418 "No such post." 419 ); 420 dbus_g_method_return_error(context, error); 426 if (context) { 427 error = g_error_new(g_quark_from_string("blog-service"), 428 404, 429 "No such post."); 430 dbus_g_method_return_error(context, error); 431 } 421 432 return FALSE; 422 433 } … … 430 441 431 442 if (!clo->post->title || !clo->post->content) { 432 error = g_error_new(g_quark_from_string("blog-service"),433 412,434 "No title or content."435 );436 443 blog_post_free(clo->post); 437 444 g_free(clo); 438 dbus_g_method_return_error(context, error); 445 if (context) { 446 error = g_error_new(g_quark_from_string("blog-service"), 447 412, 448 "No title or content." 449 ); 450 dbus_g_method_return_error(context, error); 451 } 439 452 return FALSE; 440 453 } … … 461 474 struct UpdateClosure *closure = user_data; 462 475 if (!(--closure->count)) { 463 dbus_g_method_return(closure->context); 476 if (closure->context) { 477 dbus_g_method_return(closure->context); 478 } 464 479 g_free(user_data); 465 480 }
