<p></p>
<p>Since it is intended that the line number is always positive (and it is in both cases where <code>editor_goto_line()</code> is called) and the sign is communicated in <code>offset</code> it is a programming error if <code>line_no < 0</code> so it should use one of the glib checks that log a warning, eg <code>g_return_val_if_fail()</code>.  Have a look at the usage elsewhere in Geany since Glib doesn't bother to document it any more.</p>
<p>Also its really only needed to check for out of range after the offset calculation, checking before and setting to max will still give an out of range result (for any current line except 0) so no need to check before.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/geany/geany/pull/2973#issuecomment-955147309">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAIOWJ7TJVFQNGHRHAOEUQTUJN2EJANCNFSM5HAS4DXQ">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub">Android</a>.
<img src="https://github.com/notifications/beacon/AAIOWJ2H3CWCDBTRBRYYLYTUJN2EJA5CNFSM5HAS4DX2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHDXGILI.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/geany/geany/pull/2973#issuecomment-955147309",
"url": "https://github.com/geany/geany/pull/2973#issuecomment-955147309",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>