Closed (fixed)
Project:
Openlayers
Version:
7.x-2.x-dev
Component:
Code
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
21 Jul 2011 at 09:42 UTC
Updated:
19 Nov 2011 at 09:40 UTC
When there is no data to render in a Data Overlay we get these messages:
Which can be made silent with a change like that:
diff --git a/modules/openlayers_views/views/openlayers_views_style_data.inc b/modules/openlayers_views/views/openlayers_views_style_data.inc
index 04850d5..ec0495b 100644
--- a/modules/openlayers_views/views/openlayers_views_style_data.inc
+++ b/modules/openlayers_views/views/openlayers_views_style_data.inc
@@ -33,9 +33,11 @@ class openlayers_views_style_data extends views_plugin_style {
// If we are in preview mode, dump out some useful information about this data layer
$output = "You can use the following parameters in your styles as dynamic values";
$output .= "\n------------\n";
- $keys = array_keys($data);
- foreach ($data[$keys[0]]['attributes'] as $key => $value) {
- $output .= '${'.$key."}\n";
+ if (!empty($data)) {
+ $keys = array_keys($data);
+ foreach ($data[$keys[0]]['attributes'] as $key => $value) {
+ $output .= '${'.$key."}\n";
+ }
}
$output .= "\n------------\n";
Comments
Comment #1
Countzero commentedThanks for the tip. Seems good to me and make the error disappear.
Related to the same logic, an Openlayers Map display fails with the following error :
Call to a member function render() on a non-object
... when no data is pulled. This one seems tougher to solve.
Comment #2
kurtzhong commentedNice fix, thanks.
Comment #3
zzolo commentedThansk @ao2! Committed. @Countzero, if you can provide an error message or more information, please open a new issue for that error.