responsiv / campaign-plugin

[PREMIUM] Send professional campaign messages to your subscribers.
http://octobercms.com/plugin/responsiv-campaign
5 stars 2 forks source link

Deleted campaign > view it in your browser link #31

Closed jvanremoortere closed 7 years ago

jvanremoortere commented 7 years ago

When you click the "view it in your browser"-link (go to the 'personal' campaign url) after a campaign is deleted you get the following error.

Call to a member function subscribers() on null

list($campaignId, $subscriberId, $hash) = $parts;

        /*
         * Render unique content for the subscriber
         */
        $this->campaign = Message::find((int) $campaignId);
        $this->subscriber = $this->campaign->subscribers()
            ->where('id', (int) $subscriberId)
            ->first();

        if (!$this->subscriber) {
            $this->subscriber = Subscriber::find((int) $subscriberId);
        }

It's not that you normally would delete campaigns rather than archive them but it's maybe better to throw 404?

daftspunk commented 7 years ago

Good catch, this should be fixed as basic exception handling.

daftspunk commented 7 years ago

Fixed in v1.1.22

1.1.22: Fixes exception when opening a deleted campaign in the browser.