added empty string case
This commit is contained in:
@@ -41,6 +41,9 @@ extension RCBitCoder {
|
||||
guard message.count <= configuration.maxMessageCount else {
|
||||
throw RCError.longText
|
||||
}
|
||||
guard !message.isEmpty else {
|
||||
return [RCBit](repeating: .zero, count: configuration.version.maxBitesPerSection * 4)
|
||||
}
|
||||
//mapping into character indexes
|
||||
var indexes = message.map({configuration.characters.firstIndex(of: $0)!})
|
||||
//adding staring character index and filling with special indexes
|
||||
|
||||
@@ -38,7 +38,7 @@ public extension RCCoder {
|
||||
func encode(_ image: RCImage) throws -> UIImage {
|
||||
let bits = try bitCoder.encode(message: image.message)
|
||||
let image = imageEncoder.encode(image, bits: bits)
|
||||
return UIImage()
|
||||
return image
|
||||
}
|
||||
|
||||
func decode(_ image: UIImage) throws -> String {
|
||||
|
||||
Reference in New Issue
Block a user