<?php

/**
 * @author marcus
 */
class HtmlEditorExtension extends Extension {
    public function processImage($image, $img) {
        if ($image->CanViewType && $image->getViewType() != 'Anyone') {
            return;
        }
        $img->setAttribute('data-cdnfileid', $image->ID);
    }
}

<?php

/**
 * @author marcus
 */
class HtmlEditorExtension extends Extension {
    public function processImage($image, $img) {
        if (!$image) {
            return;
        }
        if ($image->CanViewType && $image->getViewType() != 'Anyone') {
            return;
        }
        
        $img->setAttribute('data-cdnfileid', $image->ID);
    }
}

FIX Ensure an image object is present before referencing it
FIX Ensure an image object is present before referencing it
