Jump to content

Recommended Posts

Posted

What version do you have as that appears on line 111 whereas v 3.3.14.5 it appears on line 156?  When I said post your code, I mean post what your $vValue is as it's obviously an issue with splitting the $vValue.

Posted

3.3.12.0

use

Local $aArray[0][2]

_ArrayAdd($aArray, $i & '|' & _ArrayToString($aArray_1, '<>'))

user of my program sent this error. I can not repeat the error

other users don't have this error

windows 10

Array.au3

  • Developers
Posted
1 hour ago, joiner said:

user of my program sent this error. I can not repeat the error

Well, You need to provide a reproducer of the issue when you want any proper help as the provided information is not much to go on.
Likely this line returns something the func can't cope with:

_ArrayToString($aArray_1, '<>')

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted
2 hours ago, joiner said:

the error is not in my code, but in the library

Nope, not true. The error indicates that your array is out of bounds, i.e either the element index is out of the defined range or the variable itself is not an array. Nothing to do with the library.

I suggest you thorougly sanitize any input from the user and see if that error still happens :)

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Posted

sorry, it was not exactly expressed

if the data is incorrect, the function(_ArrayAdd) should return an error
 

;~ array.au3

If Not IsArray($avArray) Then Return SetError(1, 0, -1)

$vValue - always string

when I am mistaken, it points to my line, but not to a line in udf

Thanks for the discussion. I will think

 

  • Developers
Posted

Agree we need to catch as many errors where possible but we also expect the coder to be due diligent in checking data thrown at the functions.
Just show us a scriptlet that replicates the issue so we can determine whether the UDF needs changes or not.  

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted (edited)
Local $sortmod[0][2], $sortdis[0][2], $sortothers[0][2], $picdis[0][2]
Local $ksgtc = $objc.Keys()
For $i = 0 To UBound($ksgtc) - 1
    $gtitm = $objc.Item($ksgtc[$i]);always array
    If $gtitm[0] == 'mod' Then
;~      _GETCHNIT($sortmod, $ksgtc[$i], $i)
    Else
        If $gtitm[9] = 128 Then
            If $gtitm[0] == 'pic' Or $gtitm[0] == 'ico' Then
                _ArrayAdd($picdis, $i & '|' & _ArrayToString($gtitm, '<>'))
            Else
                _ArrayAdd($sortdis, $i & '|' & _ArrayToString($gtitm, '<>'))
            EndIf
        Else
            _ArrayAdd($sortothers, $i & '|' & _ArrayToString($gtitm, '<>'))
        EndIf
    EndIf
Next

this is the part of the code that causes the error

Jos, thank

Edited by joiner
Posted

This is an example of the formation of arrays. I will not pester you with questions. Waiting for updates from the user of my program

Posted (edited)
2 hours ago, joiner said:

This is an example of the formation of arrays

No, its not.  It is an example of you hoping arrays are formed and then attempting to slam whatever result comes back into an existing array (with qualifications that the returned data may not even meet...).  We will require real data and runnable scripts or this is going to be tedious.

Here is an example of the $picdis branch working, you could craft an example that doesnt work in the same manner if your concern is accurate.

;picdis example

#include<array.au3>

Local $sortmod[0][2], $sortdis[0][2], $sortothers[0][2], $picdis[0][2]
;~ Local $ksgtc = $objc.Keys()
For $i = 0 To 0
    local $gtitm[10]= ['ico',1,2,3,4,5,6,7,8,128];$gtitm = $objc.Item($ksgtc[$i]);always array
    _ArrayDisplay($gtitm)
    If $gtitm[0] == 'mod' Then
;~      _GETCHNIT($sortmod, $ksgtc[$i], $i)
    Else
        If $gtitm[9] = 128 Then
            If $gtitm[0] == 'pic' Or $gtitm[0] == 'ico' Then
                _ArrayAdd($picdis, $i & '|' & _ArrayToString($gtitm, '<>'))
            Else
                _ArrayAdd($sortdis, $i & '|' & _ArrayToString($gtitm, '<>'))
            EndIf
        Else
            _ArrayAdd($sortothers, $i & '|' & _ArrayToString($gtitm, '<>'))
        EndIf
    EndIf
    
    _ArrayDisplay($picdis)
Next

 

Edited by iamtheky

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Posted (edited)

ver. AutoIt 3.3.12.0

#include <Array.au3>
Local $aArray_1[1]
Local $aArray[0][2]
$aArray_1[0] = 'string' & @CRLF & 'string'
_ArrayAdd($aArray, 'string' & '|' & _ArrayToString($aArray_1, '<>'))

There is no error in version 3.3.14.5

I apologize, the theme for the old version AutoIT

 

Edited by joiner

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...