Membership membership_get_expire_date() Function possible bug

Hello, I was looking into the get_expire_date() function, and I noticed there is a possible bug:

function membership_get_expire_date( $sub_id = null, $date_format = null ) {
	global $member;

	if ( $member && is_a( $member, 'M_Membership' ) ) {
		if ( !$sub_id ) {
			$sub_ids = $member->get_subscription_ids();
			if ( count( $sub_ids ) > 0 ) {
				$sub_id = $sub_ids[0];
			}
		}

		if ( $sub_id ) {
			$expired = get_user_meta( $member->ID, 'expire_current_' . $sub_ids[0], true );
			if ( $expired ) {
				if ( !$date_format ) {
					$date_format = DATE_COOKIE;
				}
				return date( $date_format, $expired );
			}
		}
	}

	return __( 'unknown', 'membership' );
}

Notice the if ($sub_id) check uses $sub_ids[0] instead the passed variable within the function.

Eg. when you try to pass a $sub_id variable to the function it returns as 'unknown', as it tries to use the $sub_ids[0], which haven't been "collected" as the boolean was false in the block of code above.

Please advise?

Kind regards,
Alex