danyaPostfactum / modx-ace

ACE editor integration into MODx
24 stars 23 forks source link

OnDocFormPrerender Fatal error #16

Closed Fi1osof closed 11 years ago

Fi1osof commented 11 years ago

Fatal error: Call to a member function get() on a non-object in /var/www/modxshop.webtm.ru/v01/public_html/core/cache/includes/elements/modplugin/1.include.cache.php on line 122

$mimeType = $modx->getObject('modContentType', $modx->controller->resourceArray['content_type'])->get('mime_type');

Error if resource does not exists.

danyaPostfactum commented 11 years ago

How can we edit a non-existing resource? Do you mean creating new resource? But resourceArray exists in any case, doesn't it? Anyway, this error occurs on Resource Overview action. What workaround do you offer? check $controller->resourceArray existence ?

I also need to add modContentType object existence check.

Fi1osof commented 11 years ago

Try open non-existsing resource: manager/?a=resource/update&id=999999

I does add checking: if(!$o = $modx->getObject('modContentType', $modx->controller->resourceArray['content_type'])){ return; } $mimeType = $o->get('mime_type');

danyaPostfactum commented 11 years ago

Fixed https://github.com/danyaPostfactum/modx-ace/commit/2372eb7e8810fcaa224ae2432917f1fb676365a9