Index: /trunk/source/cocoa-ide/cocoa-editor.lisp
===================================================================
--- /trunk/source/cocoa-ide/cocoa-editor.lisp	(revision 14159)
+++ /trunk/source/cocoa-ide/cocoa-editor.lisp	(revision 14160)
@@ -1481,5 +1481,5 @@
          (styles (slot-value textstorage 'styles))
          (newcolor (#/color sender)))
-    (dotimes (i 4)
+    (dotimes (i (#/count styles))
       (let* ((dict (#/objectAtIndex: styles i)))
         (#/setValue:forKey: dict newcolor #&NSForegroundColorAttributeName)))
