Comments (1)
Normally NaN and Infinity values should be ignored by default, but on some devices (Android 6) these values trigger crashes in conjunction with arcs.
Solutions:
` private boolean execute_gr_arc() {
GR.BDraw b = createGrObj_start(GR.Type.Arc); // create Graphic Object and get variable
if (b == null) return false;
Var.Val saveVal = mVal;
if (!isNext(',')) return false;
int[] ltrb = getArgs4I();
if (ltrb == null) return false;
if (!isNext(',')) return false;
//Double[] angles = getArgsDD();
//if (angles == null) return false;
// vv 2018-12-25gt
if (!evalNumericExpression()) return false; // get angle
if (EvalNumericExpressionValue.isNaN())return RunTimeError("Start angle is Not a Number (NaN)");
if (EvalNumericExpressionValue.isInfinite())return RunTimeError("Start angle is infinite");
float startAngle = EvalNumericExpressionValue.floatValue();
if (!isNext(',')) { return false; }
if (!evalNumericExpression()) return false; // get angle
if (EvalNumericExpressionValue.isNaN())return RunTimeError("Sweep angle is Not a Number (NaN)");
if (EvalNumericExpressionValue.isInfinite())return RunTimeError("Sweep angle is infinite");
float sweepAngle = EvalNumericExpressionValue.floatValue();
// ^^ 2018-12-25gt
if (!isNext(',') || !evalNumericExpression()) return false;
int fillMode = EvalNumericExpressionValue.intValue();
//b.arc(ltrb, (float)angles[0], (float)angles[1], fillMode);
b.arc(ltrb, startAngle, sweepAngle, fillMode);// 2018-12-25gt
return createGrObj_finish(b, saveVal); // store the object and return its index
}
`
` private boolean execute_gr_modify() {
int obj = getObjectNumber("Object Number out of range");
if (obj < 0) return false;
GR.BDraw b = DisplayList.get(obj); // get the object to change
GR.Type type = b.type();
while (isNext(',')) {
if (!getStringArg()) return false; // get the parameter string
if (!isNext(',')) return false;
String parm = StringConstant;
String sVal = "";
int iVal = 0;
float fVal = 0.0f;
if (parm.equals("text")|| parm.toLowerCase().equals("_text")) { // Also to lower case 2017-07-15gt
if (!getStringArg()) return false; // get the parameter string
sVal = StringConstant;
} else {
if (!evalNumericExpression()) return false; // get parameter value
// vv 2018-12-25gt
if (EvalNumericExpressionValue.isNaN())return RunTimeError("An numeric argument is Not a Number (NaN)");
if (EvalNumericExpressionValue.isInfinite())return RunTimeError("An numeric argument is infinite");
b.angle(EvalNumericExpressionValue.floatValue());
// ^^ 2018-12-25gt
fVal = EvalNumericExpressionValue.floatValue();
iVal = EvalNumericExpressionValue.intValue();
}
.......
........
`
Gregor
from basic.
Related Issues (20)
- instanceof Fails HOT 2
- Assets with a folder structure are not readable directly
- SENSORS.LIST names not all 20 standard sensor types.
- VOLKEYS.ON / VOLKEYS.OFF
- STT.RESULTS list variable is not reset at program start
- GR.CAMERA. _ _ _SHOOT The file name extension from "image.png" is wrong in a case of jpeg compression
- BYTE.WRITE.BUFFER is very slow
- The Editor stops until REPLACE ALL in Search is used with empty search string
- ROUND Input of NaN (Not a Number) Value returns 0.0 or crashes if the scale is specified. HOT 1
- USING$ Input of a NaN (Not a Number) Value for arguments needing Integer or Long values returns 0 HOT 1
- Some functions return 0.0 or 0 instead of NaN or Infinity HOT 1
- IF with a single NaN value returns **true**, but that is **wrong** HOT 3
- Command Round, double import is to unprecise
- Timer.set <value> -- cannot use a var for <value> HOT 1
- GrabURL reads cache
- On Oreo getting sensor data fails if the returned data array length is lower than three
- [Suggestion] Make the project compatible to Android Studio
- Out-of-bound GR.BITMAP.CROP crashes BASIC HOT 1
- User apks without permission crash at startup HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from basic.