Giter Site home page Giter Site logo

Comments (7)

hoangatuan avatar hoangatuan commented on June 2, 2024 1

@rakaramos @ZevEisenberg
I've raised a PR to fix this issue here: #270
Please help to review it when you have time 🙏

from muter.

ZevEisenberg avatar ZevEisenberg commented on June 2, 2024

Hi @KyosukeKotani, and thanks for taking the time to write in! Would you be able to provide a sample project that reproduces the issue?

from muter.

KyosukeKotani avatar KyosukeKotani commented on June 2, 2024

@ZevEisenberg
Thank you for your reply.
I am unable to provide the code where the error occurred immediately as it is a product code.
I will try to reproduce this issue in a sample project.
Please wait a few days.

from muter.

KyosukeKotani avatar KyosukeKotani commented on June 2, 2024

@ZevEisenberg
Thank you for your patience.
We are unable to provide a sample project, but we have identified the cause of the error and provide a sample file.

Sample File

//
//  sample_mutation.swift
//  sample-project
//

import Foundation

public final class SampleError: NSObject, NSCoding {
    public func encode(with coder: NSCoder) {
        <#code#>
    }
    
    public init?(coder: NSCoder) {
        <#code#>
    }
    public let text: String
    
    public let viewCount: Int
    public let activationFlag: Bool
    
    
    public init?(dictionary: [String: Any]) {
        guard
            let text = dictionary["Text"] as? String,
            let activationFlag = dictionary["ActivationFlag"] as? Bool,
            let viewCount = dictionary["ViewCounts"] as? Int,
            !text.isEmpty else {
            return nil
        }
        
        self.text = text
        self.viewCount = viewCount
        self.activationFlag = activationFlag
    }
    
    public func isDiscarded() -> Bool {
        
        if viewCount > 0 {
            return true
        }
        
        return false
    }

    public func isEnabledToShow() -> Bool {
        // バルーンの表示判定
        return activationFlag && !isDiscarded()
    }
}

Error Cause

// バルーンの表示判定

I have confirmed that deleting the above comment will prevent the error from occurring.

from muter.

ZevEisenberg avatar ZevEisenberg commented on June 2, 2024

Just to clarify - is the original comment in Japanese? If you replace the comment with English, does that fix the error? I'm wondering if this is a problem with how we are parsing multi-byte characters.

from muter.

KyosukeKotani avatar KyosukeKotani commented on June 2, 2024

Yes, it is. The original comment is in Japanese.
Replacing the Japanese with English fixes the error.
I too have a feeling that there is a problem with how we are parsing multi-byte characters.

from muter.

hoangatuan avatar hoangatuan commented on June 2, 2024
Screenshot 2024-02-24 at 10 00 55 PM

The problem lies at the line 74.
The nodePosition here is UTF-8 offset, but later we treat it as character offset at line 77.
If we use alphabet character, utf-8 offset will equal to character offset since we only need 1 byte for alphabet character.
For non-alphabet character, it uses multi-byte => utf-8 offset is not equal to character offset => Crash

from muter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.