diff --git a/src/html/htmlcell.cpp b/src/html/htmlcell.cpp
index 0e1b2a00fe..37514300b3 100644
--- a/src/html/htmlcell.cpp
+++ b/src/html/htmlcell.cpp
@@ -800,7 +800,7 @@ void wxHtmlContainerCell::Layout(int w)
{
prev =
next = NULL;
- for ( int n = 0; line != cell; prev = line, line = next )
+ for ( int n = 0; line != cell; prev = line, line = line->GetNext() )
{
line->SetPos(line->GetPosX() + s_indent +
((n * step) / total),