summaryrefslogtreecommitdiff
path: root/src/modules/m_alias.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/m_alias.cpp')
-rw-r--r--src/modules/m_alias.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp
index 065b9184e..b3b5f2c76 100644
--- a/src/modules/m_alias.cpp
+++ b/src/modules/m_alias.cpp
@@ -310,11 +310,11 @@ class ModuleAlias : public Module
for (unsigned int i = 0; i < newline.length(); i++)
{
char c = newline[i];
- if (c == '$')
+ if ((c == '$') && (i + 1 < newline.length()))
{
if (isdigit(newline[i+1]))
{
- int len = (newline[i+2] == '-') ? 3 : 2;
+ int len = ((i + 2 < newline.length()) && (newline[i+2] == '-')) ? 3 : 2;
std::string var = newline.substr(i, len);
result.append(GetVar(var, original_line));
i += len - 1;