Commit 0efc13b
OpenClaw Assistant
Fix #741: ValueError in WordSwapChangeNumber._alter_number for negative numbers
- Ensure change is always positive: change = abs(int(num * max_change)) + 1
- Add range validation before calling np.random.randint()
- Return empty list for invalid ranges instead of raising exception
- Maintain backward compatibility for all valid inputs
Fixes #7411 parent 0d0929c commit 0efc13b
1 file changed
Lines changed: 20 additions & 3 deletions
Lines changed: 20 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
| 107 | + | |
| 108 | + | |
108 | 109 | | |
109 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
110 | 119 | | |
111 | | - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
112 | 129 | | |
113 | 130 | | |
114 | 131 | | |
| |||
0 commit comments