diff -urp og.module og.module
--- og.module	2009-01-02 05:58:21.000000000 +0200
+++ og.module	2009-01-15 16:46:54.000000000 +0200
@@ -1670,30 +1684,42 @@ function og_msgid_server() {
   return strtolower($at);
 }
 
+/**
+ * Implementation of hook_form_alter().
+ */
 function og_form_alter(&$form, &$form_state, $form_id) {
   // Add audience selection to node forms
   if (isset($form['#node']) && $form_id == $form['#node']->type .'_node_form') {
     $node = $form['#node'];
     if (og_is_group_type($node->type)) {
       $form = array_merge($form, og_group_form($node, $form_state));
-      
+
       // Don't trample on custom label.
       if (isset($form['body_field']) && $form['body_field']['body']['#title'] == t('Body')) {
         $form['body_field']['body']['#title'] = t('Mission statement');
         $form['body_field']['body']['#description'] = t('A welcome greeting for your group home page. Consider listing the group objectives and mission.');
       }
-      
+
       $form['author']['name']['#title'] = t('Group manager');
       $form['options']['sticky']['#title'] = t('Sticky at top of group home page and other lists.');
     }
     elseif (og_is_group_post_type($node->type)) {
-      if ($group_node = og_get_group_context()) {
+      if (!$group_node = og_get_group_context()) {
+        // If we don't have a group node context, we try to assign one ourself
+        // as we might not get it directly from the menu system
+        // (e.g. using services to save a node).
+        if (!empty($node->og_groups)) {
+          $group_node = node_load(current($node->og_groups));
+          og_set_group_context($group_node);
+        }
+      }
+      if ($group_node) {
         $bc = og_get_breadcrumb($group_node);
         if (isset($node->nid)) {
           $bc[] = l($node->title, "node/$node->nid");
         }
         drupal_set_breadcrumb($bc);
-      } 
+      }
       og_form_add_og_audience($form, $form_state);
     }
   }
