I checked this error. And the problem is this piece of code:

if (file_prepare_directory($dir, FILE_CREATE_DIRECTORY)) {
    $file = file_save_data($contents, 'public://js/gmap_markers.js', FILE_EXISTS_REPLACE);
    variable_set('gmap_marker_file', $file->fid);
  }

Apparently $file can be empty and thus not being an object, resulting in the error.

This must be corrected into this:

if (file_prepare_directory($dir, FILE_CREATE_DIRECTORY)) {
    $file = file_save_data($contents, 'public://js/gmap_markers.js', FILE_EXISTS_REPLACE);
    if (!empty($file)) {
      variable_set('gmap_marker_file', $file->fid);
    }
  }
CommentFileSizeAuthor
#1 Notice-1414196.patch621 bytesphoenix

Comments

phoenix’s picture

StatusFileSize
new621 bytes

And here's the patch :)

phoenix’s picture

Status: Active » Needs review
quocnam15’s picture

Thanks so much

Refineo’s picture

I also got this error today :

Notice: Trying to get property of non-object in gmap_regenerate_markers() (line 555 of /***/sites/all/modules/contrib/gmap/gmap.module).

I am using gmap latest dev. Is the patch included in the latest dev ?

Drupal 7.12

tusharbodke’s picture

Thanks a lot Patch works fine for me and save my life!!!

mstef’s picture

Status: Needs review » Reviewed & tested by the community

Looks good - thanks

bdragon’s picture

Status: Reviewed & tested by the community » Fixed

Interesting, that has gotta be what was causing the sporadic disappearance of the marker cache that I've been seeing.

Fixed in 7.x-1.x-dev and 7.x-2.x-dev, thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.