lexrus / lexrus/LTMorphingLabel

Index out of range Error when Text is empty before the new text will be added.

Open
#109 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
8.1k
Forks
776
PR merge metrics
No merged PRs in 30d

Description

I got this Error:
Thread 1: Fatal error: Index out of range
Here:

func limboOfNewCharacter(
        _ char: Character,
        index: Int,
        progress: Float) -> LTCharacterLimbo {
            
            let currentRect = newRects[index] <---- here i got : Thread 1: Fatal error: Index out of range
            var currentFontSize = CGFloat(
                LTEasing.easeOutQuint(progress, 0, Float(font.pointSize))

the textlabel was empty (view did load) before i added new text later.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at limboOfNewCharacter, especially the newRects[index] access, and reproduce the case where the label is empty when its text is later changed. Trace how newRects is populated before this function runs. Done means adding text after an initially empty label no longer causes an index-out-of-range crash.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.