In src/core/evaluator.js
, convert a couple of if (!someVariable) { error(...); }
instances to assert(someVariable);
instead
Rather than, in a number of places, basically duplicating the logic of `assert` we can simply utilize the function directly instead.
This commit is contained in:
parent
b7ba44b530
commit
e40fd63bd3
@ -1071,14 +1071,10 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||||||
|
|
||||||
case OPS.shadingFill:
|
case OPS.shadingFill:
|
||||||
var shadingRes = resources.get('Shading');
|
var shadingRes = resources.get('Shading');
|
||||||
if (!shadingRes) {
|
assert(shadingRes, 'No shading resource found');
|
||||||
error('No shading resource found');
|
|
||||||
}
|
|
||||||
|
|
||||||
var shading = shadingRes.get(args[0].name);
|
var shading = shadingRes.get(args[0].name);
|
||||||
if (!shading) {
|
assert(shading, 'No shading object found');
|
||||||
error('No shading object found');
|
|
||||||
}
|
|
||||||
|
|
||||||
var shadingFill = Pattern.parseShading(shading, null, xref,
|
var shadingFill = Pattern.parseShading(shading, null, xref,
|
||||||
resources, self.handler);
|
resources, self.handler);
|
||||||
@ -2166,9 +2162,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||||||
// - set the type according to the descendant font
|
// - set the type according to the descendant font
|
||||||
// - get the FontDescriptor from the descendant font
|
// - get the FontDescriptor from the descendant font
|
||||||
var df = dict.get('DescendantFonts');
|
var df = dict.get('DescendantFonts');
|
||||||
if (!df) {
|
assert(df, 'Descendant fonts are not specified');
|
||||||
error('Descendant fonts are not specified');
|
|
||||||
}
|
|
||||||
dict = (isArray(df) ? xref.fetchIfRef(df[0]) : df);
|
dict = (isArray(df) ? xref.fetchIfRef(df[0]) : df);
|
||||||
|
|
||||||
type = dict.get('Subtype');
|
type = dict.get('Subtype');
|
||||||
@ -2261,9 +2255,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||||||
// FontDescriptor was not required.
|
// FontDescriptor was not required.
|
||||||
// This case is here for compatibility.
|
// This case is here for compatibility.
|
||||||
var baseFontName = dict.get('BaseFont');
|
var baseFontName = dict.get('BaseFont');
|
||||||
if (!isName(baseFontName)) {
|
assert(isName(baseFontName), 'Base font is not specified');
|
||||||
error('Base font is not specified');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Using base font name as a font name.
|
// Using base font name as a font name.
|
||||||
baseFontName = baseFontName.name.replace(/[,_]/g, '-');
|
baseFontName = baseFontName.name.replace(/[,_]/g, '-');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user