Skip to content

Commit

Permalink
fix: check if class instance is found before calling calss method is f…
Browse files Browse the repository at this point in the history
…ixed #665 (#666)
  • Loading branch information
saimonh3 authored and sabbir1991 committed Aug 23, 2019
1 parent a3f65b1 commit d01e808
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 1 addition & 3 deletions dokan.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,12 @@ public static function init() {
*
* @param $prop
*
* @return mixed
* @return Class Instance
*/
public function __get( $prop ) {
if ( array_key_exists( $prop, $this->container ) ) {
return $this->container[ $prop ];
}

return $this->{$prop};
}

/**
Expand Down
8 changes: 7 additions & 1 deletion includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2008,7 +2008,13 @@ function dokan_get_avatar_url( $url, $id_or_email, $args ) {
return $url;
}

$vendor = dokan()->vendor->get( $user->ID );
$vendor = dokan()->vendor;

if ( ! $vendor ) {
return $url;
}

$vendor = $vendor->get( $user->ID );
$gravatar_id = $vendor->get_avatar_id();

if ( ! $gravatar_id ) {
Expand Down

0 comments on commit d01e808

Please sign in to comment.