Unverified Commit f12bb30e authored by git's avatar git Committed by Jaideep Singh Kandari
Browse files

Issue #2736957 by SocialNicheGuru: Notice: Trying to get property of...

Issue #2736957 by SocialNicheGuru: Notice: Trying to get property of non-object in webform_scoring_calculate_score() (line 62 of  webform_scoring.module
parent 018bb3f9
Loading
Loading
Loading
Loading
+7 −0
Changes for webform_scoring.module: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -76,6 +76,10 @@ function _webform_score_enabled($nid) {
 */
function webform_scoring_calculate_score($node, $data) {
  $score_enabled = _webform_score_enabled($node->nid);
  // Scoring is not enabled for this node.
  // Note that this function returns a boolean. Thus return FALSE.
  if ($score_enabled == NULL)
    return FALSE;
  if ($score_enabled->enabled && _webform_score_has_cid($node, $score_enabled->cid)) {
    $query = db_select('webform_scoring_values_scores_pair', 'a');
    $query->fields('a');
@@ -128,9 +132,12 @@ function webform_scoring_webform_submission_presave($node, &$submission) {

  if ($total_score !== FALSE) {
    $score_enabled = _webform_score_enabled($node->nid);
    // Scoring is not enabled for this node.
    if($score_enabled != NULL) {
       $submission->data[$score_enabled->cid][0] = $total_score;
    }
  }
}

/**
 * Check if the webform contains a certain component