<p>Something like this could solve the issue: </p>

<pre><code>@@ -874,6 +874,7 @@ static gint NextFreeMarker(ScintillaObject* sci)
 static void SetMarker(ScintillaObject* sci,gint bookmarkNumber,gint markerNumber,gint line)
 {
        guint32 *markers;
 static void SetMarker(ScintillaObject* sci,gint bookmarkNumber,gint markerNumber,gint line)
 {
        guint32 *markers;
+       GeanyDocument *doc;
        FileData *fd;

        /* insert new marker */
@@ -882,6 +883,10 @@ static void SetMarker(ScintillaObject* sci,gint bookmarkNumber,gint markerNumber
        scintilla_send_message(sci,SCI_MARKERADD,line,markerNumber);

        /* update record of which bookmark uses which marker */
+
+       doc = document_get_current();
+       g_return_if_fail(doc != NULL);
</code></pre>

<p>but I doubt that this will be without side effect. </p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/geany/geany-plugins/issues/301#issuecomment-155179772">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/ABDrJ9oYuu1LHhBgjLEV9OPosdVIHcSaks5pEPbYgaJpZM4Ge1A-.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/geany/geany-plugins/issues/301#issuecomment-155179772"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>