diff --git a/shared/cplusplus/AST.cpp b/shared/cplusplus/AST.cpp
index 6663cbba5d5fd5bab57c709f501c9e988310c08a..ad0c65c6c2571be38a08bf3857b5f4e53862a6ed 100644
--- a/shared/cplusplus/AST.cpp
+++ b/shared/cplusplus/AST.cpp
@@ -2375,9 +2375,8 @@ unsigned TemplateArgumentListAST::firstToken() const
 
 unsigned TemplateArgumentListAST::lastToken() const
 {
-    assert(0 && "review me");
-    for (const TemplateArgumentListAST *it = this; it; it = it->next) {
-        if (! it->next)
+    for (TemplateArgumentListAST *it = this; it; it = it->next) {
+        if (! it->next && it->template_argument)
             return it->template_argument->lastToken();
     }
     return 0;