mirror of
https://github.com/ha7ilm/openwebrx.git
synced 2026-04-04 14:07:32 +00:00
prevent javascript errors if frequency is NaN
This commit is contained in:
parent
287a04be94
commit
e1dd9d32f4
1 changed files with 5 additions and 1 deletions
|
|
@ -29,7 +29,11 @@ FrequencyDisplay.prototype.getPrefix = function() {
|
|||
|
||||
FrequencyDisplay.prototype.setFrequency = function(freq) {
|
||||
this.frequency = freq;
|
||||
this.exponent = Math.floor(Math.log10(this.frequency) / 3) * 3;
|
||||
if (Number.isNaN(this.frequency)) {
|
||||
this.exponent = 0
|
||||
} else {
|
||||
this.exponent = Math.floor(Math.log10(this.frequency) / 3) * 3;
|
||||
}
|
||||
|
||||
var digits = Math.max(0, this.exponent - this.precision);
|
||||
var formatted = (freq / 10 ** this.exponent).toLocaleString(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue