Item14258: EditRowPlugin will crash with empty column format.

pencil
Priority: Normal
Current State: Closed
Released In: 2.1.3
Target Release: patch
Applies To: Extension
Component: EditRowPlugin
Branches: master Release02x01
Reported By: FlorianSchlichting
Waiting For:
Last Change By: GeorgeClark
The old EditTablePlugin seems to have been rather forgiving with regard to the column format definition, whereas EditTablePlugin will crash (exit with Perl error) when encountering something like this:

%EDITTABLE{ format="|  |  |  |  |  |  |  | select, 4, 10.5, 10.6, 10.7, 10.8  | checkbox, 1, foo, bar, baz ...

Which results in

Can't call method "jQueryMetadata" on an undefined value at lib/Foswiki/Plugins/EditRowPlugin/TableCell.pm line 119

My suggestion would be to amend getEditor() such that it returns $editors{_default} instead of undef, like for example

--- a/lib/Foswiki/Plugins/EditRowPlugin/Table.pm
+++ b/lib/Foswiki/Plugins/EditRowPlugin/Table.pm
@@ -489,6 +489,9 @@ sub getEditor {
                 $editor = $class->new();
             }
             $editors{ $colDef->{type} } = $editor;
+        } else {
+            # default to _default
+            $editor = $editors{_default};
         }
     }
     return $editor;

or alternatively return $editor || $editors{_default};

What do you think?

-- FlorianSchlichting - 21 Dec 2016

Fix looks good. I get a different crash from your example -
Can't call method "htmlEditor" on an undefined value at /var/www/foswiki/distro/core/lib/Foswiki/Plugins/EditRowPlugin/TableCell.pm line 66.

But your fix resolves it.

-- GeorgeClark - 21 Dec 2016
 
Topic revision: r5 - 18 Feb 2017, GeorgeClark - This page was cached on 09 Apr 2017 - 21:26.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License