Index: main/plugin-datainclusion/i18n/messages_en.xml
===================================================================
--- main/plugin-datainclusion/i18n/messages_en.xml	(revision 39197)
+++ main/plugin-datainclusion/i18n/messages_en.xml	(working copy)
@@ -122,6 +122,10 @@
     <message key="PLUGINS_DATAINCLUSION_CONTENT_EDITION_QUERY_LABEL">Query</message>
     <message key="PLUGINS_DATAINCLUSION_CONTENT_EDITION_QUERY_DESCRIPTION">Insert result of query</message>
     
+    <!-- UI : inline editor deleted query dialog -->
+    <message key="PLUGINS_DATAINCLUSION_CONTENT_EDITION_DELETED_QUERY_TITLE">Inexistant query</message>
+    <message key="PLUGINS_DATAINCLUSION_CONTENT_EDITION_DELETED_QUERY_MSG">The referenced query no longer exists.</message>
+    
     <!-- UI : Choose query dialog -->
     <message key="PLUGINS_DATAINCLUSION_EDITOR_QUERY_TITLE">Choose query</message>
     <message key="PLUGINS_DATAINCLUSION_EDITOR_QUERY_HELPMESSAGE">Choose a query. Its results will be added in the text area.</message>
Index: main/plugin-datainclusion/i18n/messages_fr.xml
===================================================================
--- main/plugin-datainclusion/i18n/messages_fr.xml	(revision 39197)
+++ main/plugin-datainclusion/i18n/messages_fr.xml	(working copy)
@@ -122,6 +122,10 @@
     <message key="PLUGINS_DATAINCLUSION_CONTENT_EDITION_QUERY_LABEL">Requête</message>
     <message key="PLUGINS_DATAINCLUSION_CONTENT_EDITION_QUERY_DESCRIPTION">Insère le ou les résultats d'une requête</message>
     
+    <!-- UI : inline editor deleted query dialog -->
+    <message key="PLUGINS_DATAINCLUSION_CONTENT_EDITION_DELETED_QUERY_TITLE">Requête inexistante</message>
+    <message key="PLUGINS_DATAINCLUSION_CONTENT_EDITION_DELETED_QUERY_MSG">La requête référencée n'existe plus.</message>
+    
     <!-- UI : Choose query dialog -->
     <message key="PLUGINS_DATAINCLUSION_EDITOR_QUERY_TITLE">Insérer une requête</message>
     <message key="PLUGINS_DATAINCLUSION_EDITOR_QUERY_HELPMESSAGE">Choisissez la requête à insérer dans le texte riche.</message>
Index: main/plugin-datainclusion/resources/js/org/ametys/datainclusion/ribbon/control/button/QueryEditorButton.i18n.js
===================================================================
--- main/plugin-datainclusion/resources/js/org/ametys/datainclusion/ribbon/control/button/QueryEditorButton.i18n.js	(revision 39197)
+++ main/plugin-datainclusion/resources/js/org/ametys/datainclusion/ribbon/control/button/QueryEditorButton.i18n.js	(working copy)
@@ -153,21 +153,28 @@
 	
 	var queryNode = response.selectSingleNode('query');
 	
-	var queryData = {};
-	queryData['name'] = queryNode.getAttribute('name');
-	queryData['description'] = queryNode.getAttribute('description');
-	queryData['resultType'] = queryNode.getAttribute('resultType');
-	
-	var parameters = [];
-    var parameterNodes = response.selectNodes("query/parameter");
-    for (var i= 0; i &lt; parameterNodes.length; i++)
-    {
-        var param = parameterNodes[i].getAttribute('name');
-        parameters.push(param);
-    }
-    queryData['parameters'] = parameters;
-    
-    return queryData;
+	if (!queryNode)
+	{
+		return null;
+	}
+	else
+	{
+		var queryData = {};
+		queryData['name'] = queryNode.getAttribute('name');
+		queryData['description'] = queryNode.getAttribute('description');
+		queryData['resultType'] = queryNode.getAttribute('resultType');
+		
+		var parameters = [];
+	    var parameterNodes = response.selectNodes("query/parameter");
+	    for (var i= 0; i &lt; parameterNodes.length; i++)
+	    {
+	        var param = parameterNodes[i].getAttribute('name');
+	        parameters.push(param);
+	    }
+	    queryData['parameters'] = parameters;
+	    
+	    return queryData;
+	}
 }
 
 /**
@@ -194,50 +201,63 @@
         
         // Get the data for this query.
         var queryData = this._getQueryData(queryId);
-        
-        // Name and description.
-        this._queryDetailsPanel.add(new org.ametys.HtmlContainer({
-            html: "&lt;b&gt;<i18n:text i18n:key="PLUGINS_DATAINCLUSION_HANDLE_QUERIES_NAME"/>&lt;/b&gt; : " + queryData['name'],
-            cls: "datainclusion-message-left",
-            width: 200
-        }));
-        this._queryDetailsPanel.add(new org.ametys.HtmlContainer({
-            html: "&lt;b&gt;<i18n:text i18n:key="PLUGINS_DATAINCLUSION_HANDLE_QUERIES_DESCRIPTION"/>&lt;/b&gt; : " + queryData['description'],
-            cls: "datainclusion-message-left",
-            width: 200
-        }));
-        
-        // Parameters.
-        var parameters = queryData['parameters'];
-        if (parameters.length &lt; 1)
-        {
-            this._queryParamsPanel.add(
-                new org.ametys.HtmlContainer({
-                    html: "<i18n:text i18n:key="PLUGINS_DATAINCLUSION_QUERY_NO_PARAMETER"/>",
-                    cls: "datainclusion-message"
-                })
-            );
-        }
-        
-        // Add an input field per parameter.
-        for (var i= 0; i &lt; parameters.length; i++)
-        {
-            var paramName = parameters[i];
-            // Initialize the field value.
-            var field = this.addInputField(paramName);
-            if (paramValues != null &amp;&amp; paramValues[paramName] != null)
-            {
-                var value = paramValues[paramName];
-                field.setValue(value);
-            }
-            else
-            {
-                field.setValue('');
-            }
-        }
-        
-        // Force the rendering of the panel.
-        this.getElements().each(function(element) {element.doLayout(false, true);})
+        if (!queryData)
+    	{
+        	Ext.Msg.show({
+                title: "<i18n:text i18n:key="PLUGINS_DATAINCLUSION_CONTENT_EDITION_DELETED_QUERY_TITLE"/>",
+                msg: "<i18n:text i18n:key="PLUGINS_DATAINCLUSION_CONTENT_EDITION_DELETED_QUERY_MSG"/>",
+                buttons: Ext.Msg.OK,
+                icon: Ext.MessageBox.ERROR
+            });
+        	
+        	return;
+    	}
+        else
+    	{
+	        // Name and description.
+	        this._queryDetailsPanel.add(new org.ametys.HtmlContainer({
+	            html: "&lt;b&gt;<i18n:text i18n:key="PLUGINS_DATAINCLUSION_HANDLE_QUERIES_NAME"/>&lt;/b&gt; : " + queryData['name'],
+	            cls: "datainclusion-message-left",
+	            width: 200
+	        }));
+	        this._queryDetailsPanel.add(new org.ametys.HtmlContainer({
+	            html: "&lt;b&gt;<i18n:text i18n:key="PLUGINS_DATAINCLUSION_HANDLE_QUERIES_DESCRIPTION"/>&lt;/b&gt; : " + queryData['description'],
+	            cls: "datainclusion-message-left",
+	            width: 200
+	        }));
+	        
+	        // Parameters.
+	        var parameters = queryData['parameters'];
+	        if (parameters.length &lt; 1)
+	        {
+	            this._queryParamsPanel.add(
+	                new org.ametys.HtmlContainer({
+	                    html: "<i18n:text i18n:key="PLUGINS_DATAINCLUSION_QUERY_NO_PARAMETER"/>",
+	                    cls: "datainclusion-message"
+	                })
+	            );
+	        }
+	        
+	        // Add an input field per parameter.
+	        for (var i= 0; i &lt; parameters.length; i++)
+	        {
+	            var paramName = parameters[i];
+	            // Initialize the field value.
+	            var field = this.addInputField(paramName);
+	            if (paramValues != null &amp;&amp; paramValues[paramName] != null)
+	            {
+	                var value = paramValues[paramName];
+	                field.setValue(value);
+	            }
+	            else
+	            {
+	                field.setValue('');
+	            }
+	        }
+	        
+	        // Force the rendering of the panel.
+	        this.getElements().each(function(element) {element.doLayout(false, true);})
+    	}
     }
 }
 
